aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/hash_ext_test.rb
diff options
context:
space:
mode:
authorMislav Marohnić <mislav.marohnic@gmail.com>2008-09-13 20:12:17 +0200
committerPratik Naik <pratiknaik@gmail.com>2008-09-13 20:05:17 +0100
commit96055414d6197b9705e408c17236f79372a007e5 (patch)
tree6ae8b9485c441bee2de38702c6646cf7b637874f /activesupport/test/core_ext/hash_ext_test.rb
parent113de01eaf48f64d2adf9f34d699e51619af616f (diff)
downloadrails-96055414d6197b9705e408c17236f79372a007e5.tar.gz
rails-96055414d6197b9705e408c17236f79372a007e5.tar.bz2
rails-96055414d6197b9705e408c17236f79372a007e5.zip
Ensure Hash#except is allowed on a frozen hash. References #382
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activesupport/test/core_ext/hash_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 7a414e946f..44d48e7577 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -341,6 +341,20 @@ class HashExtTest < Test::Unit::TestCase
assert_equal expected, original.except!(: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) }
+ end
+
+ uses_mocha 'except with expectation' do
+ def test_except_with_mocha_expectation_on_original
+ original = { :a => 'x', :b => 'y' }
+ original.expects(:delete).never
+ original.except(:a)
+ end
+ end
end
class IWriteMyOwnXML