diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-17 13:35:39 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-17 13:55:42 -0200 |
commit | d4bf1c97cefbcbcad625aafce43282a1937759ee (patch) | |
tree | acfa21b323ff854c04eed216c18225ad89b592ef /activerecord/test/cases/dirty_test.rb | |
parent | 6d2aadef9d3bc37c678fe60ffab4e0967be062d2 (diff) | |
download | rails-d4bf1c97cefbcbcad625aafce43282a1937759ee.tar.gz rails-d4bf1c97cefbcbcad625aafce43282a1937759ee.tar.bz2 rails-d4bf1c97cefbcbcad625aafce43282a1937759ee.zip |
Extract #in_time_zone helper method duplication to a module
Diffstat (limited to 'activerecord/test/cases/dirty_test.rb')
-rw-r--r-- | activerecord/test/cases/dirty_test.rb | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index a6a7b2d528..ac1ab801da 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -27,6 +27,8 @@ class NumericData < ActiveRecord::Base end class DirtyTest < ActiveRecord::TestCase + include InTimeZome + # Dummy to force column loads so query counts are clean. def setup Person.create :first_name => 'foo' @@ -603,16 +605,4 @@ class DirtyTest < ActiveRecord::TestCase assert_equal %w(parrot_id), pirate.changed assert_nil pirate.parrot_id_was end - - def in_time_zone(zone) - old_zone = Time.zone - old_tz = ActiveRecord::Base.time_zone_aware_attributes - - Time.zone = zone ? ActiveSupport::TimeZone[zone] : nil - ActiveRecord::Base.time_zone_aware_attributes = !zone.nil? - yield - ensure - Time.zone = old_zone - ActiveRecord::Base.time_zone_aware_attributes = old_tz - end end |