Skip to content

Commit

Permalink
Wrap date part value method tests inside a uses mocha block.
Browse files Browse the repository at this point in the history
  • Loading branch information
josh authored and jeremy committed Jul 15, 2008
1 parent ea1c1f2 commit 88ff9e1
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions activesupport/test/core_ext/time_with_zone_test.rb
Expand Up @@ -342,24 +342,26 @@ def test_marshal_dump_and_load_with_tzinfo_identifier
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
uses_mocha 'TestDatePartValueMethods' do
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
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
assert_equal 14, twz.hour
assert_equal 18, twz.min
assert_equal 17, twz.sec
assert_equal 500, twz.usec
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
assert_equal 14, twz.hour
assert_equal 18, twz.min
assert_equal 17, twz.sec
assert_equal 500, twz.usec
end
end
end

Expand Down

0 comments on commit 88ff9e1

Please sign in to comment.