diff options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 5 | ||||
-rw-r--r-- | activesupport/test/core_ext/module/attr_accessor_with_default_test.rb | 16 | ||||
-rw-r--r-- | activesupport/test/option_merger_test.rb | 8 |
3 files changed, 21 insertions, 8 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 4557a10688..b2c85f15cb 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -971,6 +971,11 @@ class HashToXmlTest < Test::Unit::TestCase assert_nil hash_wia.default end + def test_should_return_self_for_with_indifferent_access + hash_wia = HashWithIndifferentAccess.new + assert_equal hash_wia, hash_wia.with_indifferent_access + end + def test_should_copy_the_default_value_when_converting_to_hash_with_indifferent_access hash = Hash.new(3) hash_wia = hash.with_indifferent_access diff --git a/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb b/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb index b9b60c4d6d..0ecd16b051 100644 --- a/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb +++ b/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb @@ -1,7 +1,7 @@ require 'abstract_unit' require 'active_support/core_ext/module/attr_accessor_with_default' -class AttrAccessorWithDefaultTest < Test::Unit::TestCase +class AttrAccessorWithDefaultTest < ActiveSupport::TestCase def setup @target = Class.new do def helper @@ -12,20 +12,28 @@ class AttrAccessorWithDefaultTest < Test::Unit::TestCase end def test_default_arg - @target.attr_accessor_with_default :foo, :bar + assert_deprecated do + @target.attr_accessor_with_default :foo, :bar + end assert_equal(:bar, @instance.foo) @instance.foo = nil assert_nil(@instance.foo) end def test_default_proc - @target.attr_accessor_with_default(:foo) {helper.upcase} + assert_deprecated do + @target.attr_accessor_with_default(:foo) {helper.upcase} + end assert_equal('HELPER', @instance.foo) @instance.foo = nil assert_nil(@instance.foo) end def test_invalid_args - assert_raise(ArgumentError) {@target.attr_accessor_with_default :foo} + assert_raise(ArgumentError) do + assert_deprecated do + @target.attr_accessor_with_default :foo + end + end end end diff --git a/activesupport/test/option_merger_test.rb b/activesupport/test/option_merger_test.rb index 5b2e16a212..2bdd3034e5 100644 --- a/activesupport/test/option_merger_test.rb +++ b/activesupport/test/option_merger_test.rb @@ -66,11 +66,11 @@ class OptionMergerTest < Test::Unit::TestCase end end - def test_nested_method_with_options_using_lamdba - local_lamdba = lambda { { :lambda => true } } + def test_nested_method_with_options_using_lambda + local_lambda = lambda { { :lambda => true } } with_options(@options) do |o| - assert_equal @options.merge(local_lamdba.call), - o.method_with_options(local_lamdba).call + assert_equal @options.merge(local_lambda.call), + o.method_with_options(local_lambda).call end end |