From 5c315a8fa6296904f5e0ba8da919fc395548cf98 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 6 Aug 2016 19:38:33 +0200 Subject: modernizes hash syntax in activesupport --- activesupport/test/core_ext/object/deep_dup_test.rb | 8 ++++---- activesupport/test/core_ext/object/to_query_test.rb | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'activesupport/test/core_ext/object') diff --git a/activesupport/test/core_ext/object/deep_dup_test.rb b/activesupport/test/core_ext/object/deep_dup_test.rb index 38981f0497..2c0526eebf 100644 --- a/activesupport/test/core_ext/object/deep_dup_test.rb +++ b/activesupport/test/core_ext/object/deep_dup_test.rb @@ -12,7 +12,7 @@ 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" assert_equal nil, hash[:a][:c] @@ -20,7 +20,7 @@ class DeepDupTest < ActiveSupport::TestCase 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,7 +28,7 @@ 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" assert_equal nil, hash[:a][2] @@ -37,7 +37,7 @@ class DeepDupTest < ActiveSupport::TestCase 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 diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb index 42566d5374..aaa7e69acb 100644 --- a/activesupport/test/core_ext/object/to_query_test.rb +++ b/activesupport/test/core_ext/object/to_query_test.rb @@ -5,7 +5,7 @@ require "active_support/core_ext/string/output_safety" class ToQueryTest < ActiveSupport::TestCase def test_simple_conversion - assert_query_equal "a=10", :a => 10 + assert_query_equal "a=10", a: 10 end def test_cgi_escaping @@ -28,22 +28,22 @@ class ToQueryTest < ActiveSupport::TestCase def test_nested_conversion assert_query_equal "person%5Blogin%5D=seckar&person%5Bname%5D=Nicholas", - :person => Hash[:login, "seckar", :name, "Nicholas"] + person: Hash[:login, "seckar", :name, "Nicholas"] end def test_multiple_nested assert_query_equal "account%5Bperson%5D%5Bid%5D=20&person%5Bid%5D=10", - Hash[:account, {:person => {:id => 20}}, :person, {:id => 10}] + Hash[:account, {person: {id: 20}}, :person, {id: 10}] end def test_array_values assert_query_equal "person%5Bid%5D%5B%5D=10&person%5Bid%5D%5B%5D=20", - :person => {:id => [10, 20]} + person: {id: [10, 20]} end def test_array_values_are_not_sorted assert_query_equal "person%5Bid%5D%5B%5D=20&person%5Bid%5D%5B%5D=10", - :person => {:id => [20, 10]} + person: {id: [20, 10]} end def test_empty_array -- cgit v1.2.3