diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/class/attribute_test.rb | 6 | ||||
-rw-r--r-- | activesupport/test/time_zone_test.rb | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index 06b4cf075f..24aa5c0eba 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -59,4 +59,10 @@ class ClassAttributeTest < ActiveSupport::TestCase object = Class.new { class_attribute :setting, :instance_writer => false }.new assert_raise(NoMethodError) { object.setting = 'boom' } end + + test 'works well with singleton classes' do + object = @klass.new + object.singleton_class.setting = 'foo' + assert_equal 'foo', object.setting + end end diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index ce43c6507d..68027f7c94 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -75,6 +75,14 @@ class TimeZoneTest < Test::Unit::TestCase end end + def test_unknown_timezones_delegation_to_tzinfo + zone = ActiveSupport::TimeZone['America/Montevideo'] + assert_equal ActiveSupport::TimeZone, zone.class + assert_equal zone.object_id, ActiveSupport::TimeZone['America/Montevideo'].object_id + assert_equal Time.utc(2010, 1, 31, 22), zone.utc_to_local(Time.utc(2010, 2)) # daylight saving offset -0200 + assert_equal Time.utc(2010, 3, 31, 21), zone.utc_to_local(Time.utc(2010, 4)) # standard offset -0300 + end + def test_today Time.stubs(:now).returns(Time.utc(2000, 1, 1, 4, 59, 59)) # 1 sec before midnight Jan 1 EST assert_equal Date.new(1999, 12, 31), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today |