diff options
author | Pavel Pravosud <pavel@pravosud.com> | 2017-02-23 14:43:56 -0800 |
---|---|---|
committer | Pavel Pravosud <pavel@pravosud.com> | 2017-02-23 15:24:22 -0800 |
commit | b74c7e939ae5bec5c7b98c456a3b9ceb56a0ca17 (patch) | |
tree | 3aeb9e6cd1f3b2517485c2c510010576d5ebabe2 /activesupport/test/core_ext | |
parent | 18afe45d7c564e5b9bc453bbe06a2aa78aebe246 (diff) | |
download | rails-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.rb | 10 |
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 |