aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorBernard Potocki <bernard.potocki@imanel.org>2015-05-12 17:48:09 +0200
committerSean Griffin <sean@thoughtbot.com>2015-07-17 17:17:23 -0400
commit800d5ae36c8a906e6fb26d4064a6a75236f84186 (patch)
tree78e241f52d2c7d495181594f3aa990085422585b /activesupport/test
parent89448a7f5c21729568eaa12250447f313197a30d (diff)
downloadrails-800d5ae36c8a906e6fb26d4064a6a75236f84186.tar.gz
rails-800d5ae36c8a906e6fb26d4064a6a75236f84186.tar.bz2
rails-800d5ae36c8a906e6fb26d4064a6a75236f84186.zip
ActiveSupport::HashWithIndifferentAccess select and reject should return enumerator if called without block
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 663f782611..4624338df1 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -551,6 +551,11 @@ class HashExtTest < ActiveSupport::TestCase
assert_instance_of ActiveSupport::HashWithIndifferentAccess, hash
end
+ def test_indifferent_select_returns_enumerator
+ enum = ActiveSupport::HashWithIndifferentAccess.new(@strings).select
+ assert_instance_of Enumerator, enum
+ end
+
def test_indifferent_select_returns_a_hash_when_unchanged
hash = ActiveSupport::HashWithIndifferentAccess.new(@strings).select {|k,v| true}
@@ -572,6 +577,11 @@ class HashExtTest < ActiveSupport::TestCase
assert_instance_of ActiveSupport::HashWithIndifferentAccess, hash
end
+ def test_indifferent_reject_returns_enumerator
+ enum = ActiveSupport::HashWithIndifferentAccess.new(@strings).reject
+ assert_instance_of Enumerator, enum
+ end
+
def test_indifferent_reject_bang
indifferent_strings = ActiveSupport::HashWithIndifferentAccess.new(@strings)
indifferent_strings.reject! {|k,v| v != 1}