aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_with_zone_test.rb
diff options
context:
space:
mode:
authorgbuesing <gbuesing@gmail.com>2008-05-08 22:07:21 -0500
committergbuesing <gbuesing@gmail.com>2008-05-08 22:07:21 -0500
commit4f03190f262c07c1f389957ff7ae76901495d824 (patch)
tree621f5ccd85e2815f46f95bbb4b2195c879680bba /activesupport/test/core_ext/time_with_zone_test.rb
parent618d695f1115c00ce058950af199d5d4dc06385a (diff)
downloadrails-4f03190f262c07c1f389957ff7ae76901495d824.tar.gz
rails-4f03190f262c07c1f389957ff7ae76901495d824.tar.bz2
rails-4f03190f262c07c1f389957ff7ae76901495d824.zip
TimeWithZone: date part getter methods (#year #mon #day etc) are defined on class; no longer relying on method_missing
Diffstat (limited to 'activesupport/test/core_ext/time_with_zone_test.rb')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index df70e82c1d..64fcb4af09 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -328,10 +328,18 @@ class TimeWithZoneTest < Test::Unit::TestCase
assert_equal Time.utc(1999, 12, 31, 19), mtime.time
end
end
-
+
def test_method_missing_with_non_time_return_value
silence_warnings do # silence warnings raised by tzinfo gem
+ @twz.time.expects(:foo).returns('bar')
+ assert_equal 'bar', @twz.foo
+ end
+ end
+
+ def test_date_part_value_methods
+ silence_warnings do # silence warnings raised by tzinfo gem
twz = ActiveSupport::TimeWithZone.new(Time.utc(1999,12,31,19,18,17,500), @time_zone)
+ twz.stubs(:method_missing).returns(nil) #ensure these methods are defined directly on class
assert_equal 1999, twz.year
assert_equal 12, twz.month
assert_equal 31, twz.day