aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorPavel Pravosud <pavel@pravosud.com>2017-02-23 14:43:56 -0800
committerPavel Pravosud <pavel@pravosud.com>2017-02-23 15:24:22 -0800
commitb74c7e939ae5bec5c7b98c456a3b9ceb56a0ca17 (patch)
tree3aeb9e6cd1f3b2517485c2c510010576d5ebabe2 /activesupport/test/core_ext
parent18afe45d7c564e5b9bc453bbe06a2aa78aebe246 (diff)
downloadrails-b74c7e939ae5bec5c7b98c456a3b9ceb56a0ca17.tar.gz
rails-b74c7e939ae5bec5c7b98c456a3b9ceb56a0ca17.tar.bz2
rails-b74c7e939ae5bec5c7b98c456a3b9ceb56a0ca17.zip
Make HWIA#compact not return nil when no nils
Diffstat (limited to 'activesupport/test/core_ext')
-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 05813ad388..a6e3e59433 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -597,6 +597,16 @@ class HashExtTest < ActiveSupport::TestCase
assert_equal(@strings, compacted_hash)
assert_equal(hash_contain_nil_value, hash)
assert_instance_of ActiveSupport::HashWithIndifferentAccess, compacted_hash
+
+ empty_hash = ActiveSupport::HashWithIndifferentAccess.new
+ compacted_hash = empty_hash.compact
+
+ assert_equal compacted_hash, empty_hash
+
+ non_empty_hash = ActiveSupport::HashWithIndifferentAccess.new(foo: :bar)
+ compacted_hash = non_empty_hash.compact
+
+ assert_equal compacted_hash, non_empty_hash
end
def test_indifferent_to_hash