Moved helper method from "this" to closure scope as Jasmine has a different "this" context.