diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-03 18:38:00 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-03 18:38:00 -0300 |
commit | d516971155b342f9312eaa493ad91629f53ad356 (patch) | |
tree | d60780588ef264efc87aa98b443c2d404e7da30d | |
parent | df8e89e8f1bd2e0f249bf5d657ddd3c55833f6b9 (diff) | |
parent | 6976c7254d0741899ff2864d18bfcbca9791dec6 (diff) | |
download | rails-d516971155b342f9312eaa493ad91629f53ad356.tar.gz rails-d516971155b342f9312eaa493ad91629f53ad356.tar.bz2 rails-d516971155b342f9312eaa493ad91629f53ad356.zip |
Merge pull request #15447 from akshay-vishnoi/test-cases
Test `except!` in other cases too
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index cb706d77c2..cd0cb1a144 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -70,6 +70,8 @@ class HashExtTest < ActiveSupport::TestCase assert_respond_to h, :to_options! assert_respond_to h, :compact assert_respond_to h, :compact! + assert_respond_to h, :except + assert_respond_to h, :except! end def test_transform_keys @@ -919,13 +921,19 @@ class HashExtTest < ActiveSupport::TestCase def test_except_with_more_than_one_argument original = { :a => 'x', :b => 'y', :c => 10 } expected = { :a => 'x' } + assert_equal expected, original.except(:b, :c) + + assert_equal expected, original.except!(:b, :c) + assert_equal expected, original end def test_except_with_original_frozen original = { :a => 'x', :b => 'y' } original.freeze assert_nothing_raised { original.except(:a) } + + assert_raise(RuntimeError) { original.except!(:a) } end def test_except_with_mocha_expectation_on_original |