aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/hash/transform_keys_test.rb
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@gmail.com>2015-11-07 11:27:17 -0500
committerEileen M. Uchitelle <eileencodes@gmail.com>2015-11-07 11:27:17 -0500
commit24bddfc542cf218e395029db3ece4502ae79eb3d (patch)
tree0bd1c2e494c2222f5b8f8320844aae15d1c9c0ef /activesupport/test/core_ext/hash/transform_keys_test.rb
parent986f79a446f73c6e093419f751222768e1ccd13c (diff)
parent9addcbb00a77d6fbbb10ac242b8455a28b8f3631 (diff)
downloadrails-24bddfc542cf218e395029db3ece4502ae79eb3d.tar.gz
rails-24bddfc542cf218e395029db3ece4502ae79eb3d.tar.bz2
rails-24bddfc542cf218e395029db3ece4502ae79eb3d.zip
Merge pull request #21806 from kachick/fix-transformer-size
Return a sized Enumerator from Hash#transform_values{!}
Diffstat (limited to 'activesupport/test/core_ext/hash/transform_keys_test.rb')
-rw-r--r--activesupport/test/core_ext/hash/transform_keys_test.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/hash/transform_keys_test.rb b/activesupport/test/core_ext/hash/transform_keys_test.rb
index 5a0b99e22c..99af274614 100644
--- a/activesupport/test/core_ext/hash/transform_keys_test.rb
+++ b/activesupport/test/core_ext/hash/transform_keys_test.rb
@@ -18,15 +18,17 @@ class TransformKeysTest < ActiveSupport::TestCase
assert_same original, mapped
end
- test "transform_keys returns an Enumerator if no block is given" do
+ test "transform_keys returns a sized Enumerator if no block is given" do
original = { a: 'a', b: 'b' }
enumerator = original.transform_keys
+ assert_equal original.size, enumerator.size
assert_equal Enumerator, enumerator.class
end
- test "transform_keys! returns an Enumerator if no block is given" do
+ test "transform_keys! returns a sized Enumerator if no block is given" do
original = { a: 'a', b: 'b' }
enumerator = original.transform_keys!
+ assert_equal original.size, enumerator.size
assert_equal Enumerator, enumerator.class
end