I am using ActiveSupport::TimeZone to set the time zone on a location based on the zip code.
def set_time_zone
self.time_zone = ActiveSupport::TimeZone.find_by_zipcode(self.zip)
end
This works just fine in the application itself. I am calling the set_time_zone on before_save.
In running the tests with Rspec, when it tries to run the set_time_zone method it errors out with "undefined method 'find_by_zipcode'in ActiveSupport::TimeZone"
I have included "require 'active_support/time_with_zone'" in my spec helper as well.
For now my work around is excluding the before save if in test environment.
Any ideas would be great.