diff options
Diffstat (limited to 'activesupport/test/core_ext/object/deep_dup_test.rb')
-rw-r--r-- | activesupport/test/core_ext/object/deep_dup_test.rb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/activesupport/test/core_ext/object/deep_dup_test.rb b/activesupport/test/core_ext/object/deep_dup_test.rb index aa839201ea..e335ec1b40 100644 --- a/activesupport/test/core_ext/object/deep_dup_test.rb +++ b/activesupport/test/core_ext/object/deep_dup_test.rb @@ -1,8 +1,7 @@ -require 'abstract_unit' -require 'active_support/core_ext/object' +require "abstract_unit" +require "active_support/core_ext/object" class DeepDupTest < ActiveSupport::TestCase - def test_array_deep_dup array = [1, [2, 3]] dup = array.deep_dup @@ -12,15 +11,15 @@ class DeepDupTest < ActiveSupport::TestCase end def test_hash_deep_dup - hash = { :a => { :b => 'b' } } + hash = { a: { b: "b" } } dup = hash.deep_dup - dup[:a][:c] = 'c' + dup[:a][:c] = "c" assert_equal nil, hash[:a][:c] - assert_equal 'c', dup[:a][:c] + assert_equal "c", dup[:a][:c] end def test_array_deep_dup_with_hash_inside - array = [1, { :a => 2, :b => 3 } ] + array = [1, { a: 2, b: 3 } ] dup = array.deep_dup dup[1][:c] = 4 assert_equal nil, array[1][:c] @@ -28,16 +27,16 @@ class DeepDupTest < ActiveSupport::TestCase end def test_hash_deep_dup_with_array_inside - hash = { :a => [1, 2] } + hash = { a: [1, 2] } dup = hash.deep_dup - dup[:a][2] = 'c' + dup[:a][2] = "c" assert_equal nil, hash[:a][2] - assert_equal 'c', dup[:a][2] + assert_equal "c", dup[:a][2] end def test_deep_dup_initialize zero_hash = Hash.new 0 - hash = { :a => zero_hash } + hash = { a: zero_hash } dup = hash.deep_dup assert_equal 0, dup[:a][44] end @@ -55,5 +54,4 @@ class DeepDupTest < ActiveSupport::TestCase dup = hash.deep_dup assert_equal 1, dup.keys.length end - end |