aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorKenichi Kamiya <kachick1@gmail.com>2015-09-29 10:46:16 +0900
committerKenichi Kamiya <kachick1@gmail.com>2015-09-29 12:31:58 +0900
commit9addcbb00a77d6fbbb10ac242b8455a28b8f3631 (patch)
treea6b857cfc128417f4e00e4bf934ea13fbff9dd17 /activesupport/test/core_ext
parent64df657026010a6c0500a17f64cd39a9996dc58e (diff)
downloadrails-9addcbb00a77d6fbbb10ac242b8455a28b8f3631.tar.gz
rails-9addcbb00a77d6fbbb10ac242b8455a28b8f3631.tar.bz2
rails-9addcbb00a77d6fbbb10ac242b8455a28b8f3631.zip
Return a sized Enumerator from Hash#{transform_values{!}|transform_keys{!}}
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/hash/transform_keys_test.rb6
-rw-r--r--activesupport/test/core_ext/hash/transform_values_test.rb6
2 files changed, 8 insertions, 4 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
diff --git a/activesupport/test/core_ext/hash/transform_values_test.rb b/activesupport/test/core_ext/hash/transform_values_test.rb
index 7c33227dc0..114022fbaf 100644
--- a/activesupport/test/core_ext/hash/transform_values_test.rb
+++ b/activesupport/test/core_ext/hash/transform_values_test.rb
@@ -47,15 +47,17 @@ class TransformValuesTest < ActiveSupport::TestCase
assert_nil mapped[:b]
end
- test "transform_values returns an Enumerator if no block is given" do
+ test "transform_values returns a sized Enumerator if no block is given" do
original = { a: 'a', b: 'b' }
enumerator = original.transform_values
+ assert_equal original.size, enumerator.size
assert_equal Enumerator, enumerator.class
end
- test "transform_values! returns an Enumerator if no block is given" do
+ test "transform_values! returns a sized Enumerator if no block is given" do
original = { a: 'a', b: 'b' }
enumerator = original.transform_values!
+ assert_equal original.size, enumerator.size
assert_equal Enumerator, enumerator.class
end