aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods_test.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-11-17 13:35:39 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-11-17 13:55:42 -0200
commitd4bf1c97cefbcbcad625aafce43282a1937759ee (patch)
treeacfa21b323ff854c04eed216c18225ad89b592ef /activerecord/test/cases/attribute_methods_test.rb
parent6d2aadef9d3bc37c678fe60ffab4e0967be062d2 (diff)
downloadrails-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/attribute_methods_test.rb')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb14
1 files changed, 2 insertions, 12 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index 1ae379769f..059dc8cff3 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -12,6 +12,8 @@ require 'models/contact'
require 'models/keyboard'
class AttributeMethodsTest < ActiveRecord::TestCase
+ include InTimeZome
+
fixtures :topics, :developers, :companies, :computers
def setup
@@ -800,18 +802,6 @@ class AttributeMethodsTest < ActiveRecord::TestCase
Topic.columns.select { |c| [:time, :date, :datetime, :timestamp].include?(c.type) }
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
-
def privatize(method_signature)
@target.class_eval(<<-private_method, __FILE__, __LINE__ + 1)
private