aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/duration_test.rb2
-rw-r--r--activesupport/test/core_ext/hash/transform_keys_test.rb2
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb22
-rw-r--r--activesupport/test/core_ext/object/to_query_test.rb10
4 files changed, 18 insertions, 18 deletions
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
index d24a561be8..64b5bca151 100644
--- a/activesupport/test/core_ext/duration_test.rb
+++ b/activesupport/test/core_ext/duration_test.rb
@@ -74,7 +74,7 @@ class DurationTest < ActiveSupport::TestCase
def test_inspect_locale
current_locale = I18n.default_locale
I18n.default_locale = :de
- I18n.backend.store_translations(:de, { support: { array: { last_word_connector: " und " } } })
+ I18n.backend.store_translations(:de, support: { array: { last_word_connector: " und " } })
assert_equal "10 years, 1 month und 1 day", (10.years + 1.month + 1.day).inspect
ensure
I18n.default_locale = current_locale
diff --git a/activesupport/test/core_ext/hash/transform_keys_test.rb b/activesupport/test/core_ext/hash/transform_keys_test.rb
index af91a79415..ea34a47b3d 100644
--- a/activesupport/test/core_ext/hash/transform_keys_test.rb
+++ b/activesupport/test/core_ext/hash/transform_keys_test.rb
@@ -52,7 +52,7 @@ class TransformKeysTest < ActiveSupport::TestCase
end
end
- original = HashDescendant.new({ a: "a", b: "b" })
+ original = HashDescendant.new(a: "a", b: "b")
mapped = original.transform_keys { |k| "#{k}!".to_sym }
assert_equal({ a: "a", b: "b" }, original)
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 1253c13c5a..8a9f33ae53 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -111,7 +111,7 @@ class HashExtTest < ActiveSupport::TestCase
transformed_hash = @mixed.dup
transformed_hash.transform_keys!{ |key| key.to_s.upcase }
assert_equal @upcase_strings, transformed_hash
- assert_equal @mixed, { :a => 1, "b" => 2 }
+ assert_equal @mixed, :a => 1, "b" => 2
end
def test_deep_transform_keys!
@@ -127,7 +127,7 @@ class HashExtTest < ActiveSupport::TestCase
transformed_hash = @nested_mixed.deep_dup
transformed_hash.deep_transform_keys!{ |key| key.to_s.upcase }
assert_equal @nested_upcase_strings, transformed_hash
- assert_equal @nested_mixed, { "a" => { b: { "c" => 3 } } }
+ assert_equal @nested_mixed, "a" => { b: { "c" => 3 } }
end
def test_symbolize_keys
@@ -167,7 +167,7 @@ class HashExtTest < ActiveSupport::TestCase
transformed_hash = @mixed.dup
transformed_hash.deep_symbolize_keys!
assert_equal @symbols, transformed_hash
- assert_equal @mixed, { :a => 1, "b" => 2 }
+ assert_equal @mixed, :a => 1, "b" => 2
end
def test_deep_symbolize_keys!
@@ -183,7 +183,7 @@ class HashExtTest < ActiveSupport::TestCase
transformed_hash = @nested_mixed.deep_dup
transformed_hash.deep_symbolize_keys!
assert_equal @nested_symbols, transformed_hash
- assert_equal @nested_mixed, { "a" => { b: { "c" => 3 } } }
+ assert_equal @nested_mixed, "a" => { b: { "c" => 3 } }
end
def test_symbolize_keys_preserves_keys_that_cant_be_symbolized
@@ -243,7 +243,7 @@ class HashExtTest < ActiveSupport::TestCase
transformed_hash = @mixed.dup
transformed_hash.stringify_keys!
assert_equal @strings, transformed_hash
- assert_equal @mixed, { :a => 1, "b" => 2 }
+ assert_equal @mixed, :a => 1, "b" => 2
end
def test_deep_stringify_keys!
@@ -259,7 +259,7 @@ class HashExtTest < ActiveSupport::TestCase
transformed_hash = @nested_mixed.deep_dup
transformed_hash.deep_stringify_keys!
assert_equal @nested_strings, transformed_hash
- assert_equal @nested_mixed, { "a" => { b: { "c" => 3 } } }
+ assert_equal @nested_mixed, "a" => { b: { "c" => 3 } }
end
def test_symbolize_keys_for_hash_with_indifferent_access
@@ -447,7 +447,7 @@ class HashExtTest < ActiveSupport::TestCase
def test_update_with_to_hash_conversion
hash = HashWithIndifferentAccess.new
- hash.update HashByConversion.new({ a: 1 })
+ hash.update HashByConversion.new(a: 1)
assert_equal hash["a"], 1
end
@@ -472,7 +472,7 @@ class HashExtTest < ActiveSupport::TestCase
def test_merge_with_to_hash_conversion
hash = HashWithIndifferentAccess.new
- merged = hash.merge HashByConversion.new({ a: 1 })
+ merged = hash.merge HashByConversion.new(a: 1)
assert_equal merged["a"], 1
end
@@ -676,7 +676,7 @@ class HashExtTest < ActiveSupport::TestCase
end
def test_to_options_on_indifferent_preserves_works_as_hash_with_dup
- h = HashWithIndifferentAccess.new({ a: { b: "b" } })
+ h = HashWithIndifferentAccess.new(a: { b: "b" })
dup = h.dup
dup[:a][:c] = "c"
@@ -777,8 +777,8 @@ class HashExtTest < ActiveSupport::TestCase
end
def test_deep_merge_on_indifferent_access
- hash_1 = HashWithIndifferentAccess.new({ a: "a", b: "b", c: { c1: "c1", c2: "c2", c3: { d1: "d1" } } })
- hash_2 = HashWithIndifferentAccess.new({ a: 1, c: { c1: 2, c3: { d2: "d2" } } })
+ hash_1 = HashWithIndifferentAccess.new(a: "a", b: "b", c: { c1: "c1", c2: "c2", c3: { d1: "d1" } })
+ hash_2 = HashWithIndifferentAccess.new(a: 1, c: { c1: 2, c3: { d2: "d2" } })
hash_3 = { a: 1, c: { c1: 2, c3: { d2: "d2" } } }
expected = { "a" => 1, "b" => "b", "c" => { "c1" => 2, "c2" => "c2", "c3" => { "d1" => "d1", "d2" => "d2" } } }
assert_equal expected, hash_1.deep_merge(hash_2)
diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb
index aaa7e69acb..2eff475274 100644
--- a/activesupport/test/core_ext/object/to_query_test.rb
+++ b/activesupport/test/core_ext/object/to_query_test.rb
@@ -54,15 +54,15 @@ class ToQueryTest < ActiveSupport::TestCase
assert_equal "",
{}.to_query
assert_query_equal "a=1&b%5Bc%5D=3",
- { a: 1, b: { c: 3, d: {} } }
+ a: 1, b: { c: 3, d: {} }
assert_query_equal "",
- { a: {b: {c: {}}} }
+ a: {b: {c: {}}}
assert_query_equal "b%5Bc%5D=false&b%5Be%5D=&b%5Bf%5D=&p=12",
- { p: 12, b: { c: false, e: nil, f: "" } }
+ p: 12, b: { c: false, e: nil, f: "" }
assert_query_equal "b%5Bc%5D=3&b%5Bf%5D=",
- { b: { c: 3, k: {}, f: "" } }
+ b: { c: 3, k: {}, f: "" }
assert_query_equal "b=3",
- {a: [], b: 3}
+ a: [], b: 3
end
def test_hash_with_namespace