aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2018-12-20 23:02:39 +0100
committerGitHub <noreply@github.com>2018-12-20 23:02:39 +0100
commit788bc21ef38696bbcf732a7406de42c42eb05199 (patch)
treebedadebd93ede45b6f54f8d10915b3d09c678b72 /activesupport/test
parentd5699198a45a91250e1adb3ed899b0b46b4ac879 (diff)
parent25b969a4469d7baefc1b339656008dabd79c975c (diff)
downloadrails-788bc21ef38696bbcf732a7406de42c42eb05199.tar.gz
rails-788bc21ef38696bbcf732a7406de42c42eb05199.tar.bz2
rails-788bc21ef38696bbcf732a7406de42c42eb05199.zip
Merge pull request #34762 from bogdanvlviv/fix-a-few-deprecation-warnings
Follow up #34754
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb34
1 files changed, 6 insertions, 28 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index afbc90f6d7..95fdcb8faf 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -310,30 +310,16 @@ class HashExtTest < ActiveSupport::TestCase
assert_equal expected, merged
end
- def test_slice
- original = { a: "x", b: "y", c: 10 }
- expected = { a: "x", b: "y" }
-
- # Should return a new hash with only the given keys.
- assert_equal expected, original.slice(:a, :b)
- assert_not_equal expected, original
- end
-
def test_slice_inplace
original = { a: "x", b: "y", c: 10 }
- expected = { c: 10 }
+ expected_return = { c: 10 }
+ expected_original = { a: "x", b: "y" }
- # Should replace the hash with only the given keys.
- assert_equal expected, original.slice!(:a, :b)
- end
+ # Should return a hash containing the removed key/value pairs.
+ assert_equal expected_return, original.slice!(:a, :b)
- def test_slice_with_an_array_key
- original = { :a => "x", :b => "y", :c => 10, [:a, :b] => "an array key" }
- expected = { [:a, :b] => "an array key", :c => 10 }
-
- # Should return a new hash with only the given keys when given an array key.
- assert_equal expected, original.slice([:a, :b], :c)
- assert_not_equal expected, original
+ # Should replace the hash with only the given keys.
+ assert_equal expected_original, original
end
def test_slice_inplace_with_an_array_key
@@ -344,14 +330,6 @@ class HashExtTest < ActiveSupport::TestCase
assert_equal expected, original.slice!([:a, :b], :c)
end
- def test_slice_with_splatted_keys
- original = { :a => "x", :b => "y", :c => 10, [:a, :b] => "an array key" }
- expected = { a: "x", b: "y" }
-
- # Should grab each of the splatted keys.
- assert_equal expected, original.slice(*[:a, :b])
- end
-
def test_slice_bang_does_not_override_default
hash = Hash.new(0)
hash.update(a: 1, b: 2)