aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/object
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 19:38:33 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 19:38:33 +0200
commit5c315a8fa6296904f5e0ba8da919fc395548cf98 (patch)
treec20da9c73b5db9caa8c2aa711955ed17f01d396d /activesupport/test/core_ext/object
parentd22e522179c1c90e658c3ed0e9b972ec62306209 (diff)
downloadrails-5c315a8fa6296904f5e0ba8da919fc395548cf98.tar.gz
rails-5c315a8fa6296904f5e0ba8da919fc395548cf98.tar.bz2
rails-5c315a8fa6296904f5e0ba8da919fc395548cf98.zip
modernizes hash syntax in activesupport
Diffstat (limited to 'activesupport/test/core_ext/object')
-rw-r--r--activesupport/test/core_ext/object/deep_dup_test.rb8
-rw-r--r--activesupport/test/core_ext/object/to_query_test.rb10
2 files changed, 9 insertions, 9 deletions
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