From 96055414d6197b9705e408c17236f79372a007e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sat, 13 Sep 2008 20:12:17 +0200 Subject: Ensure Hash#except is allowed on a frozen hash. References #382 Signed-off-by: Pratik Naik --- activesupport/test/core_ext/hash_ext_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'activesupport/test/core_ext/hash_ext_test.rb') 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 -- cgit v1.2.3