aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2014-07-24 13:51:51 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2014-07-24 13:51:51 -0300
commit3f4e97f807eb475ac8c311e5baf138249a8a1ab2 (patch)
tree41d31e87736bce2a3d3a5cbc323f74a2cbf513a6 /activesupport/test/core_ext
parent5f25435bf4b3c4e6c1dbac92ef9063420d28dc49 (diff)
parentc17c262cfcae307def3a0657602adccaf7fa91cf (diff)
downloadrails-3f4e97f807eb475ac8c311e5baf138249a8a1ab2.tar.gz
rails-3f4e97f807eb475ac8c311e5baf138249a8a1ab2.tar.bz2
rails-3f4e97f807eb475ac8c311e5baf138249a8a1ab2.zip
Merge pull request #16281 from arthurnn/copy_default_proc_hwia
Make HWIA copy the default proc too.
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 03ec20eb39..dbbb2d77da 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -1543,6 +1543,17 @@ class HashToXmlTest < ActiveSupport::TestCase
assert_equal 3, hash_wia.default
end
+ def test_should_copy_the_default_proc_when_converting_to_hash_with_indifferent_access
+ hash = Hash.new do
+ 2 + 1
+ end
+ assert_equal 3, hash[:foo]
+
+ hash_wia = hash.with_indifferent_access
+ assert_equal 3, hash_wia[:foo]
+ assert_equal 3, hash_wia[:bar]
+ end
+
# The XML builder seems to fail miserably when trying to tag something
# with the same name as a Kernel method (throw, test, loop, select ...)
def test_kernel_method_names_to_xml