diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-12 17:48:30 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-12 17:48:30 -0500 |
commit | ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1 (patch) | |
tree | a3cce25be0c613a8e1444e1d0ff53aaed3497057 /activesupport/test | |
parent | 556204abaf95f7c995576cb1358f13de406682ab (diff) | |
parent | dd4181f47dc0f166eb5d3e47a4a0dc1594cc5669 (diff) | |
download | rails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.tar.gz rails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.tar.bz2 rails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.zip |
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/class_test.rb | 2 | ||||
-rw-r--r-- | activesupport/test/core_ext/module/model_naming_test.rb | 19 | ||||
-rw-r--r-- | activesupport/test/core_ext/time_with_zone_test.rb | 34 | ||||
-rw-r--r-- | activesupport/test/test_test.rb | 6 |
4 files changed, 44 insertions, 17 deletions
diff --git a/activesupport/test/core_ext/class_test.rb b/activesupport/test/core_ext/class_test.rb index 0346fad190..9c6071d478 100644 --- a/activesupport/test/core_ext/class_test.rb +++ b/activesupport/test/core_ext/class_test.rb @@ -38,9 +38,9 @@ class ClassTest < Test::Unit::TestCase @parent = eval("class D; end; D") @sub = eval("class E < D; end; E") @subofsub = eval("class F < E; end; F") - assert @parent.subclasses.all? { |i| [@sub.to_s, @subofsub.to_s].include?(i) } assert_equal 2, @parent.subclasses.size assert_equal [@subofsub.to_s], @sub.subclasses assert_equal [], @subofsub.subclasses + assert_equal [@sub.to_s, @subofsub.to_s].sort, @parent.subclasses.sort end end diff --git a/activesupport/test/core_ext/module/model_naming_test.rb b/activesupport/test/core_ext/module/model_naming_test.rb new file mode 100644 index 0000000000..fc73fa5c36 --- /dev/null +++ b/activesupport/test/core_ext/module/model_naming_test.rb @@ -0,0 +1,19 @@ +require 'abstract_unit' + +class ModelNamingTest < Test::Unit::TestCase + def setup + @name = ActiveSupport::ModelName.new('Post::TrackBack') + end + + def test_singular + assert_equal 'post_track_back', @name.singular + end + + def test_plural + assert_equal 'post_track_backs', @name.plural + end + + def test_partial_path + assert_equal 'post/track_backs/track_back', @name.partial_path + end +end diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 012ec373c9..0977cd8e50 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -336,24 +336,26 @@ class TimeWithZoneTest < Test::Unit::TestCase 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 diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb index 1e75e18602..26a45af255 100644 --- a/activesupport/test/test_test.rb +++ b/activesupport/test/test_test.rb @@ -84,6 +84,12 @@ class SetupAndTeardownTest < Test::Unit::TestCase assert_equal [:foo, :sentinel, :foo], self.class.teardown_callback_chain.map(&:method) end + def setup + end + + def teardown + end + protected def reset_callback_record @called_back = [] |