aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkshay Vishnoi <akshay.vishnoi@vinsol.com>2014-05-31 22:40:00 +0530
committerAkshay Vishnoi <akshay.vishnoi@vinsol.com>2014-05-31 22:40:00 +0530
commit6976c7254d0741899ff2864d18bfcbca9791dec6 (patch)
treef0335477a679c377d043df03da9059cce250547a
parentb1867187d46eb82763242818af52cd452fdff5fe (diff)
downloadrails-6976c7254d0741899ff2864d18bfcbca9791dec6.tar.gz
rails-6976c7254d0741899ff2864d18bfcbca9791dec6.tar.bz2
rails-6976c7254d0741899ff2864d18bfcbca9791dec6.zip
Test `except!` in other cases too
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb8
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