aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actioncable/test/channel/base_test.rb2
-rw-r--r--actioncable/test/channel/periodic_timers_test.rb2
-rw-r--r--actioncable/test/channel/rejection_test.rb2
-rw-r--r--actioncable/test/channel/stream_test.rb4
-rw-r--r--actioncable/test/connection/base_test.rb4
-rw-r--r--actionpack/lib/action_dispatch/journey/route.rb2
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb2
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/routing.rb2
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb2
-rw-r--r--actionpack/test/abstract/translation_test.rb6
-rw-r--r--actionpack/test/controller/flash_hash_test.rb6
-rw-r--r--actionpack/test/controller/live_stream_test.rb6
-rw-r--r--actionpack/test/controller/new_base/render_action_test.rb6
-rw-r--r--actionpack/test/controller/parameters/always_permitted_parameters_test.rb6
-rw-r--r--actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb20
-rw-r--r--actionpack/test/controller/parameters/multi_parameter_attributes_test.rb6
-rw-r--r--actionpack/test/controller/parameters/nested_parameters_permit_test.rb60
-rw-r--r--actionpack/test/controller/parameters/parameters_permit_test.rb4
-rw-r--r--actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb10
-rw-r--r--actionpack/test/controller/params_wrapper_test.rb50
-rw-r--r--actionpack/test/controller/redirect_test.rb8
-rw-r--r--actionpack/test/controller/renderer_test.rb2
-rw-r--r--actionpack/test/controller/required_params_test.rb2
-rw-r--r--actionpack/test/controller/resources_test.rb4
-rw-r--r--actionpack/test/controller/routing_test.rb186
-rw-r--r--actionpack/test/controller/test_case_test.rb20
-rw-r--r--actionpack/test/controller/url_for_test.rb16
-rw-r--r--actionpack/test/controller/url_rewriter_test.rb6
-rw-r--r--actionpack/test/controller/webservice_test.rb2
-rw-r--r--actionpack/test/dispatch/callbacks_test.rb2
-rw-r--r--actionpack/test/dispatch/executor_test.rb2
-rw-r--r--actionpack/test/dispatch/rack_cache_test.rb2
-rw-r--r--actionpack/test/dispatch/reloader_test.rb2
-rw-r--r--actionpack/test/dispatch/request/json_params_parsing_test.rb28
-rw-r--r--actionpack/test/dispatch/response_test.rb4
-rw-r--r--actionpack/test/dispatch/routing_assertions_test.rb32
-rw-r--r--actionpack/test/journey/route_test.rb32
-rw-r--r--actionpack/test/journey/router_test.rb14
-rw-r--r--actionview/test/abstract_unit.rb2
-rw-r--r--actionview/test/actionpack/controller/view_paths_test.rb4
-rw-r--r--actionview/test/activerecord/polymorphic_routes_test.rb6
-rw-r--r--actionview/test/template/date_helper_test.rb34
-rw-r--r--actionview/test/template/digestor_test.rb2
-rw-r--r--actionview/test/template/form_collections_helper_test.rb8
-rw-r--r--actionview/test/template/form_helper_test.rb14
-rw-r--r--actionview/test/template/form_options_helper_test.rb8
-rw-r--r--actionview/test/template/form_tag_helper_test.rb30
-rw-r--r--actionview/test/template/resolver_patterns_test.rb8
-rw-r--r--actionview/test/template/tag_helper_test.rb14
-rw-r--r--actionview/test/template/testing/fixture_resolver_test.rb4
-rw-r--r--actionview/test/template/testing/null_resolver_test.rb2
-rw-r--r--activejob/test/support/integration/adapters/sidekiq.rb5
-rw-r--r--activemodel/lib/active_model/errors.rb6
-rw-r--r--activemodel/test/cases/forbidden_attributes_protection_test.rb4
-rw-r--r--activemodel/test/cases/type/integer_test.rb2
-rw-r--r--activemodel/test/cases/validations/confirmation_validation_test.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/connection_specification.rb10
-rw-r--r--activerecord/test/cases/adapters/mysql2/active_schema_test.rb10
-rw-r--r--activerecord/test/cases/adapters/mysql2/connection_test.rb8
-rw-r--r--activerecord/test/cases/adapters/postgresql/connection_test.rb8
-rw-r--r--activerecord/test/cases/adapters/postgresql/hstore_test.rb12
-rw-r--r--activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb6
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb6
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb2
-rw-r--r--activerecord/test/cases/attribute_set_test.rb2
-rw-r--r--activerecord/test/cases/base_test.rb22
-rw-r--r--activerecord/test/cases/connection_specification/resolver_test.rb2
-rw-r--r--activerecord/test/cases/date_test.rb2
-rw-r--r--activerecord/test/cases/log_subscriber_test.rb8
-rw-r--r--activerecord/test/cases/migration/change_table_test.rb2
-rw-r--r--activerecord/test/cases/migration_test.rb20
-rw-r--r--activerecord/test/cases/nested_attributes_test.rb22
-rw-r--r--activerecord/test/cases/persistence_test.rb18
-rw-r--r--activerecord/test/cases/pooled_connections_test.rb6
-rw-r--r--activerecord/test/cases/relations_test.rb4
-rw-r--r--activerecord/test/cases/sanitize_test.rb6
-rw-r--r--activerecord/test/cases/validations/i18n_generate_message_validation_test.rb8
-rw-r--r--activerecord/test/cases/validations_test.rb2
-rw-r--r--activerecord/test/models/person.rb2
-rw-r--r--activesupport/test/caching_test.rb6
-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
-rw-r--r--activesupport/test/json/encoding_test_cases.rb2
-rw-r--r--activesupport/test/message_encryptor_test.rb2
-rw-r--r--activesupport/test/message_verifier_test.rb2
-rw-r--r--activesupport/test/number_helper_i18n_test.rb2
-rw-r--r--activesupport/test/number_helper_test.rb28
-rw-r--r--activesupport/test/xml_mini_test.rb2
-rw-r--r--guides/rails_guides/markdown.rb6
-rw-r--r--railties/lib/rails/commands/server.rb6
-rw-r--r--railties/lib/rails/generators/actions.rb2
-rw-r--r--railties/test/application/assets_test.rb4
-rw-r--r--railties/test/application/configuration_test.rb6
-rw-r--r--railties/test/application/mailer_previews_test.rb2
-rw-r--r--railties/test/generators/create_migration_test.rb8
-rw-r--r--railties/test/generators/model_generator_test.rb12
-rw-r--r--railties/test/railties/engine_test.rb8
100 files changed, 486 insertions, 563 deletions
diff --git a/actioncable/test/channel/base_test.rb b/actioncable/test/channel/base_test.rb
index 67200ce3ce..69bbeb7818 100644
--- a/actioncable/test/channel/base_test.rb
+++ b/actioncable/test/channel/base_test.rb
@@ -74,7 +74,7 @@ class ActionCable::Channel::BaseTest < ActiveSupport::TestCase
setup do
@user = User.new "lifo"
@connection = TestConnection.new(@user)
- @channel = ChatChannel.new @connection, "{id: 1}", { id: 1 }
+ @channel = ChatChannel.new @connection, "{id: 1}", id: 1
end
test "should subscribe to a channel on initialize" do
diff --git a/actioncable/test/channel/periodic_timers_test.rb b/actioncable/test/channel/periodic_timers_test.rb
index 55e96503ff..529abb9535 100644
--- a/actioncable/test/channel/periodic_timers_test.rb
+++ b/actioncable/test/channel/periodic_timers_test.rb
@@ -60,7 +60,7 @@ class ActionCable::Channel::PeriodicTimersTest < ActiveSupport::TestCase
test "timer start and stop" do
@connection.server.event_loop.expects(:timer).times(3).returns(stub(shutdown: nil))
- channel = ChatChannel.new @connection, "{id: 1}", { id: 1 }
+ channel = ChatChannel.new @connection, "{id: 1}", id: 1
channel.unsubscribe_from_channel
assert_equal [], channel.send(:active_periodic_timers)
diff --git a/actioncable/test/channel/rejection_test.rb b/actioncable/test/channel/rejection_test.rb
index 9e011dee71..cfeb22889c 100644
--- a/actioncable/test/channel/rejection_test.rb
+++ b/actioncable/test/channel/rejection_test.rb
@@ -16,7 +16,7 @@ class ActionCable::Channel::RejectionTest < ActiveSupport::TestCase
test "subscription rejection" do
@connection.expects(:subscriptions).returns mock().tap { |m| m.expects(:remove_subscription).with instance_of(SecretChannel) }
- @channel = SecretChannel.new @connection, "{id: 1}", { id: 1 }
+ @channel = SecretChannel.new @connection, "{id: 1}", id: 1
expected = { "identifier" => "{id: 1}", "type" => "reject_subscription" }
assert_equal expected, @connection.last_transmission
diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb
index e56f5a7254..da26f81a5c 100644
--- a/actioncable/test/channel/stream_test.rb
+++ b/actioncable/test/channel/stream_test.rb
@@ -52,7 +52,7 @@ module ActionCable::StreamTests
run_in_eventmachine do
connection = TestConnection.new
connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("test_room_1", kind_of(Proc), kind_of(Proc)).returns stub_everything(:pubsub) }
- channel = ChatChannel.new connection, "{id: 1}", { id: 1 }
+ channel = ChatChannel.new connection, "{id: 1}", id: 1
connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) }
channel.unsubscribe_from_channel
@@ -84,7 +84,7 @@ module ActionCable::StreamTests
run_in_eventmachine do
connection = TestConnection.new
- ChatChannel.new connection, "{id: 1}", { id: 1 }
+ ChatChannel.new connection, "{id: 1}", id: 1
assert_nil connection.last_transmission
wait_for_async
diff --git a/actioncable/test/connection/base_test.rb b/actioncable/test/connection/base_test.rb
index 43bb03a4fe..9bcd0700cf 100644
--- a/actioncable/test/connection/base_test.rb
+++ b/actioncable/test/connection/base_test.rb
@@ -119,8 +119,8 @@ class ActionCable::Connection::BaseTest < ActionCable::TestCase
env = Rack::MockRequest.env_for(
"/test",
- { "HTTP_CONNECTION" => "upgrade", "HTTP_UPGRADE" => "websocket",
- "HTTP_HOST" => "localhost", "HTTP_ORIGIN" => "http://rubyonrails.org", "rack.hijack" => CallMeMaybe.new }
+ "HTTP_CONNECTION" => "upgrade", "HTTP_UPGRADE" => "websocket",
+ "HTTP_HOST" => "localhost", "HTTP_ORIGIN" => "http://rubyonrails.org", "rack.hijack" => CallMeMaybe.new
)
connection = ActionCable::Connection::Base.new(@server, env)
diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb
index 14f617ea3f..b6d9f4737a 100644
--- a/actionpack/lib/action_dispatch/journey/route.rb
+++ b/actionpack/lib/action_dispatch/journey/route.rb
@@ -32,7 +32,7 @@ module ActionDispatch
def self.verb; ""; end
end
- VERB_TO_CLASS = VERBS.each_with_object({ all: All }) do |verb, hash|
+ VERB_TO_CLASS = VERBS.each_with_object(all: All) do |verb, hash|
klass = const_get verb
hash[verb] = klass
hash[verb.downcase] = klass
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 405a8f229c..7034f25b09 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -2122,7 +2122,7 @@ to this:
def initialize(set) #:nodoc:
@set = set
- @scope = Scope.new({ path_names: @set.resources_path_names })
+ @scope = Scope.new(path_names: @set.resources_path_names)
@concerns = {}
end
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 9b2bb754c2..c1ea23e36d 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -731,7 +731,7 @@ module ActionDispatch
extras = environment[:extras] || {}
begin
- env = Rack::MockRequest.env_for(path, {method: method})
+ env = Rack::MockRequest.env_for(path, method: method)
rescue URI::InvalidURIError => e
raise ActionController::RoutingError, e.message
end
diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
index 27736ec0eb..cba67b2839 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -202,7 +202,7 @@ module ActionDispatch
request.request_method = method if method
params = fail_on(ActionController::RoutingError, msg) do
- @routes.recognize_path(path, { method: method, extras: extras })
+ @routes.recognize_path(path, method: method, extras: extras)
end
request.path_parameters = params.with_indifferent_access
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index ea7e39b2e6..3008d10992 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -298,7 +298,7 @@ module ActionDispatch
process(http_method, path, *args)
else
non_kwarg_request_warning if args.any?
- process(http_method, path, { params: args[0], headers: args[1] })
+ process(http_method, path, params: args[0], headers: args[1])
end
end
diff --git a/actionpack/test/abstract/translation_test.rb b/actionpack/test/abstract/translation_test.rb
index 4b807c2e04..1e17cb9777 100644
--- a/actionpack/test/abstract/translation_test.rb
+++ b/actionpack/test/abstract/translation_test.rb
@@ -9,8 +9,7 @@ module AbstractController
class TranslationControllerTest < ActiveSupport::TestCase
def setup
@controller = TranslationController.new
- I18n.backend.store_translations(:en, {
- one: {
+ I18n.backend.store_translations(:en, one: {
two: "bar",
},
abstract_controller: {
@@ -22,8 +21,7 @@ module AbstractController
no_action: "no_action_tr",
},
},
- },
- })
+ })
end
def test_action_controller_base_responds_to_translate
diff --git a/actionpack/test/controller/flash_hash_test.rb b/actionpack/test/controller/flash_hash_test.rb
index be2bcb5ce2..16651a3fd7 100644
--- a/actionpack/test/controller/flash_hash_test.rb
+++ b/actionpack/test/controller/flash_hash_test.rb
@@ -141,7 +141,7 @@ module ActionDispatch
def test_update_sweep
@hash["hello"] = "world"
- @hash.update({"hi" => "mom"})
+ @hash.update("hi" => "mom")
@hash.sweep
assert_equal({"hello" => "world", "hi" => "mom"}, @hash.to_hash)
@@ -150,7 +150,7 @@ module ActionDispatch
def test_update_delete_sweep
@hash["hello"] = "world"
@hash.delete "hello"
- @hash.update({"hello" => "mom"})
+ @hash.update("hello" => "mom")
@hash.sweep
assert_equal({"hello" => "mom"}, @hash.to_hash)
@@ -175,7 +175,7 @@ module ActionDispatch
def test_replace_sweep
@hash["hello"] = "world"
- @hash.replace({"hi" => "mom"})
+ @hash.replace("hi" => "mom")
@hash.sweep
assert_equal({"hi" => "mom"}, @hash.to_hash)
diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb
index 6d0bc8244b..3ea02f0a19 100644
--- a/actionpack/test/controller/live_stream_test.rb
+++ b/actionpack/test/controller/live_stream_test.rb
@@ -11,7 +11,7 @@ module ActionController
response.headers["Content-Type"] = "text/event-stream"
sse = SSE.new(response.stream)
sse.write("{\"name\":\"John\"}")
- sse.write({ name: "Ryan" })
+ sse.write(name: "Ryan")
ensure
sse.close
end
@@ -19,7 +19,7 @@ module ActionController
def sse_with_event
sse = SSE.new(response.stream, event: "send-name")
sse.write("{\"name\":\"John\"}")
- sse.write({ name: "Ryan" })
+ sse.write(name: "Ryan")
ensure
sse.close
end
@@ -459,7 +459,7 @@ class LiveStreamRouterTest < ActionDispatch::IntegrationTest
response.headers["Content-Type"] = "text/event-stream"
sse = SSE.new(response.stream)
sse.write("{\"name\":\"John\"}")
- sse.write({ name: "Ryan" })
+ sse.write(name: "Ryan")
ensure
sse.close
end
diff --git a/actionpack/test/controller/new_base/render_action_test.rb b/actionpack/test/controller/new_base/render_action_test.rb
index b92f86da58..f87c29f977 100644
--- a/actionpack/test/controller/new_base/render_action_test.rb
+++ b/actionpack/test/controller/new_base/render_action_test.rb
@@ -260,11 +260,9 @@ end
module RenderActionWithBothLayouts
class BasicController < ActionController::Base
- self.view_paths = [ActionView::FixtureResolver.new({
- "render_action_with_both_layouts/basic/hello_world.html.erb" => "Hello World!",
+ self.view_paths = [ActionView::FixtureResolver.new( "render_action_with_both_layouts/basic/hello_world.html.erb" => "Hello World!",
"layouts/application.html.erb" => "Oh Hi <%= yield %> Bye",
- "layouts/render_action_with_both_layouts/basic.html.erb" => "With Controller Layout! <%= yield %> Bye"
- })]
+ "layouts/render_action_with_both_layouts/basic.html.erb" => "With Controller Layout! <%= yield %> Bye")]
def hello_world
render action: "hello_world"
diff --git a/actionpack/test/controller/parameters/always_permitted_parameters_test.rb b/actionpack/test/controller/parameters/always_permitted_parameters_test.rb
index 40e2f5152a..9c9749c037 100644
--- a/actionpack/test/controller/parameters/always_permitted_parameters_test.rb
+++ b/actionpack/test/controller/parameters/always_permitted_parameters_test.rb
@@ -19,10 +19,8 @@ class AlwaysPermittedParametersTest < ActiveSupport::TestCase
end
test "permits parameters that are whitelisted" do
- params = ActionController::Parameters.new({
- book: { pages: 65 },
- format: "json"
- })
+ params = ActionController::Parameters.new( book: { pages: 65 },
+ format: "json")
permitted = params.permit book: [:pages]
assert permitted.permitted?
end
diff --git a/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb b/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb
index b1a9b9176c..a6e48b8ded 100644
--- a/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb
+++ b/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb
@@ -11,10 +11,8 @@ class LogOnUnpermittedParamsTest < ActiveSupport::TestCase
end
test "logs on unexpected param" do
- params = ActionController::Parameters.new({
- book: { pages: 65 },
- fishing: "Turnips"
- })
+ params = ActionController::Parameters.new( book: { pages: 65 },
+ fishing: "Turnips")
assert_logged("Unpermitted parameter: fishing") do
params.permit(book: [:pages])
@@ -22,11 +20,9 @@ class LogOnUnpermittedParamsTest < ActiveSupport::TestCase
end
test "logs on unexpected params" do
- params = ActionController::Parameters.new({
- book: { pages: 65 },
+ params = ActionController::Parameters.new( book: { pages: 65 },
fishing: "Turnips",
- car: "Mersedes"
- })
+ car: "Mersedes")
assert_logged("Unpermitted parameters: fishing, car") do
params.permit(book: [:pages])
@@ -34,9 +30,7 @@ class LogOnUnpermittedParamsTest < ActiveSupport::TestCase
end
test "logs on unexpected nested param" do
- params = ActionController::Parameters.new({
- book: { pages: 65, title: "Green Cats and where to find then." }
- })
+ params = ActionController::Parameters.new( book: { pages: 65, title: "Green Cats and where to find then." })
assert_logged("Unpermitted parameter: title") do
params.permit(book: [:pages])
@@ -44,9 +38,7 @@ class LogOnUnpermittedParamsTest < ActiveSupport::TestCase
end
test "logs on unexpected nested params" do
- params = ActionController::Parameters.new({
- book: { pages: 65, title: "Green Cats and where to find then.", author: "G. A. Dog" }
- })
+ params = ActionController::Parameters.new( book: { pages: 65, title: "Green Cats and where to find then.", author: "G. A. Dog" })
assert_logged("Unpermitted parameters: title, author") do
params.permit(book: [:pages])
diff --git a/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb b/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb
index 1009f533a4..44e39135a2 100644
--- a/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb
+++ b/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb
@@ -3,8 +3,7 @@ require "action_controller/metal/strong_parameters"
class MultiParameterAttributesTest < ActiveSupport::TestCase
test "permitted multi-parameter attribute keys" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
"shipped_at(1i)" => "2012",
"shipped_at(2i)" => "3",
"shipped_at(3i)" => "25",
@@ -15,8 +14,7 @@ class MultiParameterAttributesTest < ActiveSupport::TestCase
"published_at(3i)" => "5",
"price(1)" => "R$",
"price(2f)" => "2.02"
- }
- })
+ })
permitted = params.permit book: [ :shipped_at, :price ]
diff --git a/actionpack/test/controller/parameters/nested_parameters_permit_test.rb b/actionpack/test/controller/parameters/nested_parameters_permit_test.rb
index f3c1caee61..e3f1ba5f0a 100644
--- a/actionpack/test/controller/parameters/nested_parameters_permit_test.rb
+++ b/actionpack/test/controller/parameters/nested_parameters_permit_test.rb
@@ -7,8 +7,7 @@ class NestedParametersPermitTest < ActiveSupport::TestCase
end
test "permitted nested parameters" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
title: "Romeo and Juliet",
authors: [{
name: "William Shakespeare",
@@ -26,8 +25,7 @@ class NestedParametersPermitTest < ActiveSupport::TestCase
isbn: "x"
}
},
- magazine: "Mjallo!"
- })
+ magazine: "Mjallo!")
permitted = params.permit book: [ :title, { authors: [ :name ] }, { details: :pages }, :id ]
@@ -45,14 +43,12 @@ class NestedParametersPermitTest < ActiveSupport::TestCase
end
test "permitted nested parameters with a string or a symbol as a key" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
"authors" => [
{ name: "William Shakespeare", born: "1564-04-26" },
{ name: "Christopher Marlowe" }
]
- }
- })
+ })
permitted = params.permit book: [ { "authors" => [ :name ] } ]
@@ -70,24 +66,20 @@ class NestedParametersPermitTest < ActiveSupport::TestCase
end
test "nested arrays with strings" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
genres: ["Tragedy"]
- }
- })
+ })
permitted = params.permit book: {genres: []}
assert_equal ["Tragedy"], permitted[:book][:genres]
end
test "permit may specify symbols or strings" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
title: "Romeo and Juliet",
author: "William Shakespeare"
},
- magazine: "Shakespeare Today"
- })
+ magazine: "Shakespeare Today")
permitted = params.permit({book: ["title", :author]}, "magazine")
assert_equal "Romeo and Juliet", permitted[:book][:title]
@@ -96,23 +88,19 @@ class NestedParametersPermitTest < ActiveSupport::TestCase
end
test "nested array with strings that should be hashes" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
genres: ["Tragedy"]
- }
- })
+ })
permitted = params.permit book: { genres: :type }
assert_empty permitted[:book][:genres]
end
test "nested array with strings that should be hashes and additional values" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
title: "Romeo and Juliet",
genres: ["Tragedy"]
- }
- })
+ })
permitted = params.permit book: [ :title, { genres: :type } ]
assert_equal "Romeo and Juliet", permitted[:book][:title]
@@ -120,26 +108,22 @@ class NestedParametersPermitTest < ActiveSupport::TestCase
end
test "nested string that should be a hash" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
genre: "Tragedy"
- }
- })
+ })
permitted = params.permit book: { genre: :type }
assert_nil permitted[:book][:genre]
end
test "fields_for-style nested params" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
authors_attributes: {
'0': { name: "William Shakespeare", age_of_death: "52" },
'1': { name: "Unattributed Assistant" },
'2': { name: %w(injected names) }
}
- }
- })
+ })
permitted = params.permit book: { authors_attributes: [ :name ] }
assert_not_nil permitted[:book][:authors_attributes]["0"]
@@ -152,14 +136,12 @@ class NestedParametersPermitTest < ActiveSupport::TestCase
end
test "fields_for-style nested params with negative numbers" do
- params = ActionController::Parameters.new({
- book: {
+ params = ActionController::Parameters.new( book: {
authors_attributes: {
'-1': { name: "William Shakespeare", age_of_death: "52" },
'-2': { name: "Unattributed Assistant" }
}
- }
- })
+ })
permitted = params.permit book: { authors_attributes: [:name] }
assert_not_nil permitted[:book][:authors_attributes]["-1"]
@@ -171,14 +153,12 @@ class NestedParametersPermitTest < ActiveSupport::TestCase
end
test "nested number as key" do
- params = ActionController::Parameters.new({
- product: {
+ params = ActionController::Parameters.new( product: {
properties: {
"0" => "prop0",
"1" => "prop1"
}
- }
- })
+ })
params = params.require(:product).permit(properties: ["0"])
assert_not_nil params[:properties]["0"]
assert_nil params[:properties]["1"]
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb
index ca59e670b9..7467d5a78f 100644
--- a/actionpack/test/controller/parameters/parameters_permit_test.rb
+++ b/actionpack/test/controller/parameters/parameters_permit_test.rb
@@ -256,9 +256,9 @@ class ParametersPermitTest < ActiveSupport::TestCase
test "permitted takes a default value when Parameters.permit_all_parameters is set" do
begin
ActionController::Parameters.permit_all_parameters = true
- params = ActionController::Parameters.new({ person: {
+ params = ActionController::Parameters.new(person: {
age: "32", name: { first: "David", last: "Heinemeier Hansson" }
- }})
+ })
assert params.slice(:person).permitted?
assert params[:person][:name].permitted?
diff --git a/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb b/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb
index 80a057dbac..bcb16eaf89 100644
--- a/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb
+++ b/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb
@@ -11,10 +11,8 @@ class RaiseOnUnpermittedParamsTest < ActiveSupport::TestCase
end
test "raises on unexpected params" do
- params = ActionController::Parameters.new({
- book: { pages: 65 },
- fishing: "Turnips"
- })
+ params = ActionController::Parameters.new( book: { pages: 65 },
+ fishing: "Turnips")
assert_raises(ActionController::UnpermittedParameters) do
params.permit(book: [:pages])
@@ -22,9 +20,7 @@ class RaiseOnUnpermittedParamsTest < ActiveSupport::TestCase
end
test "raises on unexpected nested params" do
- params = ActionController::Parameters.new({
- book: { pages: 65, title: "Green Cats and where to find then." }
- })
+ params = ActionController::Parameters.new( book: { pages: 65, title: "Green Cats and where to find then." })
assert_raises(ActionController::UnpermittedParameters) do
params.permit(book: [:pages])
diff --git a/actionpack/test/controller/params_wrapper_test.rb b/actionpack/test/controller/params_wrapper_test.rb
index c1f1f33dc0..7d49e8d114 100644
--- a/actionpack/test/controller/params_wrapper_test.rb
+++ b/actionpack/test/controller/params_wrapper_test.rb
@@ -4,7 +4,7 @@ module Admin; class User; end; end
module ParamsWrapperTestHelp
def with_default_wrapper_options(&block)
- @controller.class._set_wrapper_options({format: [:json]})
+ @controller.class._set_wrapper_options(format: [:json])
@controller.class.inherited(@controller.class)
yield
end
@@ -50,7 +50,7 @@ class ParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu" }
- assert_equal @request.filtered_parameters, { "controller" => "params_wrapper_test/users", "action" => "parse", "username" => "sikachu", "user" => { "username" => "sikachu" } }
+ assert_equal @request.filtered_parameters, "controller" => "params_wrapper_test/users", "action" => "parse", "username" => "sikachu", "user" => { "username" => "sikachu" }
end
end
@@ -58,7 +58,7 @@ class ParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu" }
- assert_parameters({ "username" => "sikachu", "user" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "user" => { "username" => "sikachu" })
end
end
@@ -68,7 +68,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu" }
- assert_parameters({ "username" => "sikachu", "person" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "person" => { "username" => "sikachu" })
end
end
@@ -78,7 +78,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu" }
- assert_parameters({ "username" => "sikachu", "person" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "person" => { "username" => "sikachu" })
end
end
@@ -88,7 +88,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu" })
end
end
@@ -98,7 +98,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu" })
end
end
@@ -108,7 +108,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "person" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "person" => { "username" => "sikachu" })
end
end
@@ -116,7 +116,7 @@ class ParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/xml"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer" })
+ assert_parameters("username" => "sikachu", "title" => "Developer")
end
end
@@ -125,7 +125,7 @@ class ParamsWrapperTest < ActionController::TestCase
UsersController.wrap_parameters false
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer" })
+ assert_parameters("username" => "sikachu", "title" => "Developer")
end
end
@@ -135,7 +135,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/xml"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu", "title" => "Developer" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu", "title" => "Developer" })
end
end
@@ -143,7 +143,7 @@ class ParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "authenticity_token" => "pwned", "_method" => "put", "utf8" => "&#9731;", "username" => "sikachu" }
- assert_parameters({ "authenticity_token" => "pwned", "_method" => "put", "utf8" => "&#9731;", "username" => "sikachu", "user" => { "username" => "sikachu" }})
+ assert_parameters("authenticity_token" => "pwned", "_method" => "put", "utf8" => "&#9731;", "username" => "sikachu", "user" => { "username" => "sikachu" })
end
end
@@ -151,7 +151,7 @@ class ParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "user" => { "username" => "sikachu" }}
- assert_parameters({ "user" => { "username" => "sikachu" }})
+ assert_parameters("user" => { "username" => "sikachu" })
end
end
@@ -159,7 +159,7 @@ class ParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "person" => { "username" => "sikachu" }}
- assert_parameters({ "person" => { "username" => "sikachu" }, "user" => {"person" => { "username" => "sikachu" }}})
+ assert_parameters("person" => { "username" => "sikachu" }, "user" => {"person" => { "username" => "sikachu" }})
end
end
@@ -168,7 +168,7 @@ class ParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu" })
end
end
end
@@ -180,7 +180,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "person" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "person" => { "username" => "sikachu" })
end
end
end
@@ -189,7 +189,7 @@ class ParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu", "title" => "Developer" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu", "title" => "Developer" })
end
end
@@ -198,7 +198,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/json"
get :parse, params: { "user" => { "username" => "nixon" } }
assert_parameters(
- {"user" => { "username" => "nixon" } }
+ "user" => { "username" => "nixon" }
)
end
end
@@ -208,7 +208,7 @@ class ParamsWrapperTest < ActionController::TestCase
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: {}
assert_parameters(
- {"user" => { } }
+ "user" => { }
)
end
end
@@ -254,7 +254,7 @@ class NamespacedParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu" }
- assert_parameters({"username" => "sikachu", "user" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "user" => { "username" => "sikachu" })
end
end
@@ -264,7 +264,7 @@ class NamespacedParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "user" => { "username" => "sikachu" })
end
ensure
Admin.send :remove_const, :User
@@ -277,7 +277,7 @@ class NamespacedParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "title" => "Developer" }
- assert_parameters({ "username" => "sikachu", "title" => "Developer", "user" => { "title" => "Developer" }})
+ assert_parameters("username" => "sikachu", "title" => "Developer", "user" => { "title" => "Developer" })
end
ensure
Object.send :remove_const, :User
@@ -304,7 +304,7 @@ class AnonymousControllerParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu" }
- assert_parameters({ "username" => "sikachu" })
+ assert_parameters("username" => "sikachu")
end
end
@@ -313,7 +313,7 @@ class AnonymousControllerParamsWrapperTest < ActionController::TestCase
@controller.class.wrap_parameters(name: "guest")
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu" }
- assert_parameters({ "username" => "sikachu", "guest" => { "username" => "sikachu" }})
+ assert_parameters("username" => "sikachu", "guest" => { "username" => "sikachu" })
end
end
end
@@ -349,7 +349,7 @@ class IrregularInflectionParamsWrapperTest < ActionController::TestCase
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = "application/json"
post :parse, params: { "username" => "sikachu", "test_attr" => "test_value" }
- assert_parameters({ "username" => "sikachu", "test_attr" => "test_value", "paramswrappernews_item" => { "test_attr" => "test_value" }})
+ assert_parameters("username" => "sikachu", "test_attr" => "test_value", "paramswrappernews_item" => { "test_attr" => "test_value" })
end
end
end
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb
index 9ce647d26e..0539580e14 100644
--- a/actionpack/test/controller/redirect_test.rb
+++ b/actionpack/test/controller/redirect_test.rb
@@ -29,11 +29,11 @@ class RedirectController < ActionController::Base
end
def redirect_with_status
- redirect_to({action: "hello_world", status: 301})
+ redirect_to(action: "hello_world", status: 301)
end
def redirect_with_status_hash
- redirect_to({action: "hello_world"}, {status: 301})
+ redirect_to({action: "hello_world"}, status: 301)
end
def redirect_with_protocol
@@ -45,7 +45,7 @@ class RedirectController < ActionController::Base
end
def url_redirect_with_status_hash
- redirect_to("http://www.example.com", {status: 301})
+ redirect_to("http://www.example.com", status: 301)
end
def relative_url_redirect_with_status
@@ -53,7 +53,7 @@ class RedirectController < ActionController::Base
end
def relative_url_redirect_with_status_hash
- redirect_to("/things/stuff", {status: 301})
+ redirect_to("/things/stuff", status: 301)
end
def redirect_to_back_with_status
diff --git a/actionpack/test/controller/renderer_test.rb b/actionpack/test/controller/renderer_test.rb
index a5465f55fa..d6f09f2d90 100644
--- a/actionpack/test/controller/renderer_test.rb
+++ b/actionpack/test/controller/renderer_test.rb
@@ -88,7 +88,7 @@ class RendererTest < ActiveSupport::TestCase
end
test "rendering with user specified defaults" do
- ApplicationController.renderer.defaults.merge!({ hello: "hello", https: true })
+ ApplicationController.renderer.defaults.merge!(hello: "hello", https: true)
renderer = ApplicationController.renderer.new
content = renderer.render inline: "<%= request.ssl? %>"
diff --git a/actionpack/test/controller/required_params_test.rb b/actionpack/test/controller/required_params_test.rb
index 6de954700f..15131b3217 100644
--- a/actionpack/test/controller/required_params_test.rb
+++ b/actionpack/test/controller/required_params_test.rb
@@ -75,7 +75,7 @@ class ParametersRequireTest < ActiveSupport::TestCase
test "Deprecated methods are deprecated" do
assert_deprecated do
- ActionController::Parameters.new(foo: "bar").merge!({bar: "foo"})
+ ActionController::Parameters.new(foo: "bar").merge!(bar: "foo")
end
end
end
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb
index 2514991d7d..36df54e1ff 100644
--- a/actionpack/test/controller/resources_test.rb
+++ b/actionpack/test/controller/resources_test.rb
@@ -1067,7 +1067,7 @@ class ResourcesTest < ActionController::TestCase
match "/products", to: "products#show", via: :all
end
- assert_routing({ method: "all", path: "/products" }, { controller: "products", action: "show" })
+ assert_routing({ method: "all", path: "/products" }, controller: "products", action: "show")
end
end
@@ -1078,7 +1078,7 @@ class ResourcesTest < ActionController::TestCase
end
assert_raises(Minitest::Assertion) do
- assert_routing({ method: "all", path: "/products" }, { controller: "products", action: "show" })
+ assert_routing({ method: "all", path: "/products" }, controller: "products", action: "show")
end
end
end
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 7d506c1976..0b2c7b7a4f 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -29,12 +29,10 @@ class UriReservedCharactersRoutingTest < ActiveSupport::TestCase
def test_route_generation_escapes_unsafe_path_characters
assert_equal "/content/act#{@escaped}ion/var#{@escaped}iable/add#{@escaped}itional-1/add#{@escaped}itional-2",
- url_for(@set, {
- controller: "content",
+ url_for(@set, controller: "content",
action: "act#{@segment}ion",
variable: "var#{@segment}iable",
- additional: ["add#{@segment}itional-1", "add#{@segment}itional-2"]
- })
+ additional: ["add#{@segment}itional-1", "add#{@segment}itional-2"])
end
def test_route_recognition_unescapes_path_components
@@ -47,12 +45,10 @@ class UriReservedCharactersRoutingTest < ActiveSupport::TestCase
def test_route_generation_allows_passing_non_string_values_to_generated_helper
assert_equal "/content/action/variable/1/2",
- url_for(@set, {
- controller: "content",
+ url_for(@set, controller: "content",
action: "action",
variable: "variable",
- additional: [1, 2]
- })
+ additional: [1, 2])
end
end
@@ -309,18 +305,18 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
assert_equal({controller: "admin/user", action: "show", id: "10"}, rs.recognize_path("/admin/user/show/10"))
- assert_equal "/admin/user/show/10", url_for(rs, { controller: "admin/user", action: "show", id: 10 })
+ assert_equal "/admin/user/show/10", url_for(rs, controller: "admin/user", action: "show", id: 10)
get URI("http://test.host/admin/user/list/10")
assert_equal({ controller: "admin/user", action: "list", id: "10" },
controller.request.path_parameters)
- assert_equal "/admin/user/show", controller.url_for({ action: "show", only_path: true })
- assert_equal "/admin/user/list/10", controller.url_for({only_path: true})
+ assert_equal "/admin/user/show", controller.url_for(action: "show", only_path: true)
+ assert_equal "/admin/user/list/10", controller.url_for(only_path: true)
- assert_equal "/admin/stuff", controller.url_for({ controller: "stuff", only_path: true })
- assert_equal "/stuff", controller.url_for({ controller: "/stuff", only_path: true })
+ assert_equal "/admin/stuff", controller.url_for(controller: "stuff", only_path: true)
+ assert_equal "/stuff", controller.url_for(controller: "/stuff", only_path: true)
end
def test_route_with_colon_first
@@ -341,8 +337,8 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
assert_equal({ action: "auth_google", controller: "content" }, rs.recognize_path("/content/auth_google"))
assert_equal({ action: "auth-facebook", controller: "content" }, rs.recognize_path("/content/auth-facebook"))
- assert_equal "/content/auth_google", url_for(rs, { controller: "content", action: "auth_google" })
- assert_equal "/content/auth-facebook", url_for(rs, { controller: "content", action: "auth-facebook" })
+ assert_equal "/content/auth_google", url_for(rs, controller: "content", action: "auth_google")
+ assert_equal "/content/auth-facebook", url_for(rs, controller: "content", action: "auth-facebook")
end
def test_route_with_regexp_for_controller
@@ -358,8 +354,8 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
assert_equal({controller: "content", action: "foo"},
rs.recognize_path("/content/foo"))
- assert_equal "/admin/user/foo", url_for(rs, { controller: "admin/user", admintoken: "foo", action: "index" })
- assert_equal "/content/foo", url_for(rs, { controller: "content", action: "foo" })
+ assert_equal "/admin/user/foo", url_for(rs, controller: "admin/user", admintoken: "foo", action: "index")
+ assert_equal "/content/foo", url_for(rs, controller: "content", action: "foo")
end
def test_route_with_regexp_and_captures_for_controller
@@ -385,14 +381,14 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
# Without a file extension
assert_equal "/user/download/file",
- url_for(rs, { controller: "user", action: "download", file: "file" })
+ url_for(rs, controller: "user", action: "download", file: "file")
assert_equal({controller: "user", action: "download", file: "file"},
rs.recognize_path("/user/download/file"))
# Now, let's try a file with an extension, really a dot (.)
assert_equal "/user/download/file.jpg",
- url_for(rs, { controller: "user", action: "download", file: "file.jpg" })
+ url_for(rs, controller: "user", action: "download", file: "file.jpg")
assert_equal({controller: "user", action: "download", file: "file.jpg"},
rs.recognize_path("/user/download/file.jpg"))
@@ -540,7 +536,7 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
get URI("http://test.host/admin/user/index/10")
assert_equal "/admin/stuff/show/10",
- controller.url_for({controller: "stuff", action: "show", id: 10, only_path: true})
+ controller.url_for(controller: "stuff", action: "show", id: 10, only_path: true)
end
def test_paths_escaped
@@ -586,7 +582,7 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
get "post/:id" => "post#show", :constraints => { id: /\d+/ }, :as => "post"
end
assert_raise(ActionController::UrlGenerationError) do
- url_for(rs, { controller: "post", action: "show", bad_param: "foo", use_route: "post" })
+ url_for(rs, controller: "post", action: "show", bad_param: "foo", use_route: "post")
end
end
@@ -596,7 +592,7 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
assert_equal "/pages/boo",
- url_for(rs, { controller: "content", action: "show_file", path: %w(pages boo) })
+ url_for(rs, controller: "content", action: "show_file", path: %w(pages boo))
end
def test_dynamic_recall_paths_allowed
@@ -621,9 +617,9 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
get URI("http://test.host/pages/show")
- assert_equal "/page/20", controller.url_for({ id: 20, only_path: true })
- assert_equal "/page/20", url_for(rs, { controller: "pages", id: 20, action: "show" })
- assert_equal "/pages/boo", url_for(rs, { controller: "pages", action: "boo" })
+ assert_equal "/page/20", controller.url_for(id: 20, only_path: true)
+ assert_equal "/page/20", url_for(rs, controller: "pages", id: 20, action: "show")
+ assert_equal "/pages/boo", url_for(rs, controller: "pages", action: "boo")
end
def test_route_with_integer_default
@@ -635,10 +631,10 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
end
- assert_equal "/page", url_for(rs, { controller: "content", action: "show_page" })
- assert_equal "/page", url_for(rs, { controller: "content", action: "show_page", id: 1 })
- assert_equal "/page", url_for(rs, { controller: "content", action: "show_page", id: "1" })
- assert_equal "/page/10", url_for(rs, { controller: "content", action: "show_page", id: 10 })
+ assert_equal "/page", url_for(rs, controller: "content", action: "show_page")
+ assert_equal "/page", url_for(rs, controller: "content", action: "show_page", id: 1)
+ assert_equal "/page", url_for(rs, controller: "content", action: "show_page", id: "1")
+ assert_equal "/page/10", url_for(rs, controller: "content", action: "show_page", id: 10)
assert_equal({controller: "content", action: "show_page", id: 1 }, rs.recognize_path("/page"))
assert_equal({controller: "content", action: "show_page", id: "1"}, rs.recognize_path("/page/1"))
@@ -655,14 +651,14 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
end
- assert_equal "/page/foo", url_for(rs, { controller: "content", action: "show_page", id: "foo" })
+ assert_equal "/page/foo", url_for(rs, controller: "content", action: "show_page", id: "foo")
assert_equal({ controller: "content", action: "show_page", id: "foo" }, rs.recognize_path("/page/foo"))
token = "\321\202\320\265\320\272\321\201\321\202" # 'text' in Russian
token.force_encoding(Encoding::BINARY)
escaped_token = CGI::escape(token)
- assert_equal "/page/" + escaped_token, url_for(rs, { controller: "content", action: "show_page", id: token })
+ assert_equal "/page/" + escaped_token, url_for(rs, controller: "content", action: "show_page", id: token)
assert_equal({ controller: "content", action: "show_page", id: token }, rs.recognize_path("/page/#{escaped_token}"))
end
@@ -677,10 +673,10 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
get "post/:id" => "post#show", :constraints => {id: /\d+/}, :as => "post"
end
- assert_equal "/post/10", url_for(rs, { controller: "post", action: "show", id: 10 })
+ assert_equal "/post/10", url_for(rs, controller: "post", action: "show", id: 10)
assert_raise(ActionController::UrlGenerationError) do
- url_for(rs, { controller: "post", action: "show" })
+ url_for(rs, controller: "post", action: "show")
end
end
@@ -696,8 +692,8 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
end
- assert_equal "/test", url_for(rs, { controller: "post", action: "show" })
- assert_equal "/test", url_for(rs, { controller: "post", action: "show", year: nil })
+ assert_equal "/test", url_for(rs, controller: "post", action: "show")
+ assert_equal "/test", url_for(rs, controller: "post", action: "show", year: nil)
assert_equal("http://test.host/test", setup_for_named_route.send(:blog_url))
end
@@ -712,24 +708,24 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
assert_equal "/pages/2005",
- url_for(rs, { controller: "content", action: "list_pages", year: 2005 })
+ url_for(rs, controller: "content", action: "list_pages", year: 2005)
assert_equal "/pages/2005/6",
- url_for(rs, { controller: "content", action: "list_pages", year: 2005, month: 6 })
+ url_for(rs, controller: "content", action: "list_pages", year: 2005, month: 6)
assert_equal "/pages/2005/6/12",
- url_for(rs, { controller: "content", action: "list_pages", year: 2005, month: 6, day: 12 })
+ url_for(rs, controller: "content", action: "list_pages", year: 2005, month: 6, day: 12)
get URI("http://test.host/pages/2005/6/12")
assert_equal({ controller: "content", action: "list_pages", year: "2005", month: "6", day: "12" },
controller.request.path_parameters)
assert_equal "/pages/2005/6/4",
- controller.url_for({ day: 4, only_path: true })
+ controller.url_for(day: 4, only_path: true)
assert_equal "/pages/2005/6",
- controller.url_for({ day: nil, only_path: true })
+ controller.url_for(day: nil, only_path: true)
assert_equal "/pages/2005",
- controller.url_for({ day: nil, month: nil, only_path: true })
+ controller.url_for(day: nil, month: nil, only_path: true)
end
def test_root_url_generation_with_controller_and_action
@@ -737,8 +733,8 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
root to: "content#index"
end
- assert_equal "/", url_for(rs, { controller: "content", action: "index" })
- assert_equal "/", url_for(rs, { controller: "content" })
+ assert_equal "/", url_for(rs, controller: "content", action: "index")
+ assert_equal "/", url_for(rs, controller: "content")
end
def test_named_root_url_generation_with_controller_and_action
@@ -746,8 +742,8 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
root to: "content#index", as: "home"
end
- assert_equal "/", url_for(rs, { controller: "content", action: "index" })
- assert_equal "/", url_for(rs, { controller: "content" })
+ assert_equal "/", url_for(rs, controller: "content", action: "index")
+ assert_equal "/", url_for(rs, controller: "content")
assert_equal("http://test.host/", setup_for_named_route.send(:home_url))
end
@@ -761,8 +757,8 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
end
- assert_equal "/categories", url_for(rs, { controller: "content", action: "categories" })
- assert_equal "/content/hi", url_for(rs, { controller: "content", action: "hi" })
+ assert_equal "/categories", url_for(rs, controller: "content", action: "categories")
+ assert_equal "/content/hi", url_for(rs, controller: "content", action: "hi")
end
def test_named_routes_array
@@ -780,12 +776,10 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
end
- assert_equal "/journal", url_for(rs, {
- controller: "content",
+ assert_equal "/journal", url_for(rs, controller: "content",
action: "list_journal",
date: nil,
- user_id: nil
- })
+ user_id: nil)
end
def setup_request_method_routes_for(method)
@@ -851,9 +845,9 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
end
end
- assert_equal "/books/7/edit", url_for(rs, { controller: "subpath_books", id: 7, action: "edit" })
- assert_equal "/items/15/complete", url_for(rs, { controller: "subpath_books", id: 15, action: "complete" })
- assert_equal "/posts/new/preview", url_for(rs, { controller: "subpath_books", action: "preview" })
+ assert_equal "/books/7/edit", url_for(rs, controller: "subpath_books", id: 7, action: "edit")
+ assert_equal "/items/15/complete", url_for(rs, controller: "subpath_books", id: 15, action: "complete")
+ assert_equal "/posts/new/preview", url_for(rs, controller: "subpath_books", action: "preview")
end
def test_failed_constraints_raises_exception_with_violated_constraints
@@ -964,7 +958,7 @@ class RouteSetTest < ActiveSupport::TestCase
end
end
assert_equal "/foo/bar/15?this=hello",
- url_for(set, { controller: "foo", action: "bar", id: 15, this: "hello" })
+ url_for(set, controller: "foo", action: "bar", id: 15, this: "hello")
end
def test_extra_keys_not_first
@@ -1111,8 +1105,8 @@ class RouteSetTest < ActiveSupport::TestCase
assert_equal 1, set.routes.size
- assert_equal "/users/show/10", url_for(set, { controller: "users", action: "show", id: 10 })
- assert_equal "/users/index/10", url_for(set, { controller: "users", id: 10 })
+ assert_equal "/users/show/10", url_for(set, controller: "users", action: "show", id: 10)
+ assert_equal "/users/index/10", url_for(set, controller: "users", id: 10)
assert_equal({controller: "users", action: "index", id: "10"}, set.recognize_path("/users/index/10"))
assert_equal({controller: "users", action: "index", id: "10"}, set.recognize_path("/users/index/10/"))
@@ -1313,7 +1307,7 @@ class RouteSetTest < ActiveSupport::TestCase
get "/people/list", controller: "people", action: "list"
end
- url = url_for(set, { controller: "people", action: "list" })
+ url = url_for(set, controller: "people", action: "list")
assert_equal "/people/list", url
end
@@ -1456,11 +1450,11 @@ class RouteSetTest < ActiveSupport::TestCase
assert_equal({ controller: "connection/manage",
action: "index", }, request_path_params("/connection/manage"))
- url = controller.url_for({ controller: "connection", only_path: true })
+ url = controller.url_for(controller: "connection", only_path: true)
assert_equal "/connection/connection", url
- url = controller.url_for({ use_route: "family_connection",
- controller: "connection", only_path: true })
+ url = controller.url_for(use_route: "family_connection",
+ controller: "connection", only_path: true)
assert_equal "/connection", url
end
@@ -1494,7 +1488,7 @@ class RouteSetTest < ActiveSupport::TestCase
get URI("http://test.host/weblog/show/1")
assert_equal "/weblog/edit?parameter=1", controller.url_for(
- {action: "edit", parameter: 1, only_path: true})
+ action: "edit", parameter: 1, only_path: true)
end
def test_format_is_not_inherit
@@ -1507,10 +1501,10 @@ class RouteSetTest < ActiveSupport::TestCase
controller.request.path_parameters)
assert_equal "/posts", controller.url_for(
- {controller: "posts", only_path: true})
+ controller: "posts", only_path: true)
assert_equal "/posts.xml", controller.url_for(
- {controller: "posts", format: "xml", only_path: true})
+ controller: "posts", format: "xml", only_path: true)
end
def test_expiry_determination_should_consider_values_with_to_param
@@ -1525,7 +1519,7 @@ class RouteSetTest < ActiveSupport::TestCase
controller.request.path_parameters)
assert_equal "/projects/1/weblog/show",
- controller.url_for({ action: "show", project_id: 1, only_path: true })
+ controller.url_for(action: "show", project_id: 1, only_path: true)
end
def test_named_route_in_nested_resource
@@ -1622,12 +1616,12 @@ class RouteSetTest < ActiveSupport::TestCase
:constraints => {name: /(david|jamis)/i}
end
- url = url_for(set, { controller: "pages", action: "show", name: "david" })
+ url = url_for(set, controller: "pages", action: "show", name: "david")
assert_equal "/page/david", url
assert_raise(ActionController::UrlGenerationError) do
- url_for(set, { controller: "pages", action: "show", name: "davidjamis" })
+ url_for(set, controller: "pages", action: "show", name: "davidjamis")
end
- url = url_for(set, { controller: "pages", action: "show", name: "JAMIS" })
+ url = url_for(set, controller: "pages", action: "show", name: "JAMIS")
assert_equal "/page/JAMIS", url
end
@@ -1666,7 +1660,7 @@ class RouteSetTest < ActiveSupport::TestCase
set.recognize_path("/page/JAMIS"))
assert_equal "/page/JAMIS",
- url_for(set, { controller: "pages", action: "show", name: "JAMIS" })
+ url_for(set, controller: "pages", action: "show", name: "JAMIS")
end
def test_routes_with_symbols
@@ -1684,8 +1678,8 @@ class RouteSetTest < ActiveSupport::TestCase
get "/hello" => "bar#index"
end
- assert_equal "/", url_for(set, { controller: "foo" })
- assert_equal "/hello", url_for(set, { controller: "bar" })
+ assert_equal "/", url_for(set, controller: "foo")
+ assert_equal "/hello", url_for(set, controller: "bar")
assert_equal({controller: "foo", action: "index"}, set.recognize_path("/"))
assert_equal({controller: "bar", action: "index"}, set.recognize_path("/hello"))
@@ -1698,7 +1692,7 @@ class RouteSetTest < ActiveSupport::TestCase
end
end
- assert_equal "/cars/buy/1/2", url_for(set, { controller: "cars", action: "buy", person: "1", car: "2" })
+ assert_equal "/cars/buy/1/2", url_for(set, controller: "cars", action: "buy", person: "1", car: "2")
assert_equal({controller: "cars", action: "buy", person: "1", car: "2"}, set.recognize_path("/cars/buy/1/2"))
end
@@ -1710,7 +1704,7 @@ class RouteSetTest < ActiveSupport::TestCase
end
end
- assert_equal "/books/list.rss", url_for(set, { controller: "books", action: "list" })
+ assert_equal "/books/list.rss", url_for(set, controller: "books", action: "list")
assert_equal({controller: "books", action: "list"}, set.recognize_path("/books/list.rss"))
end
@@ -1722,10 +1716,10 @@ class RouteSetTest < ActiveSupport::TestCase
end
end
- assert_equal "/books/list.rss", url_for(set, { controller: "books", action: "list", format: "rss" })
- assert_equal "/books/list.xml", url_for(set, { controller: "books", action: "list", format: "xml" })
- assert_equal "/books/list", url_for(set, { controller: "books", action: "list" })
- assert_equal "/books", url_for(set, { controller: "books", action: "index" })
+ assert_equal "/books/list.rss", url_for(set, controller: "books", action: "list", format: "rss")
+ assert_equal "/books/list.xml", url_for(set, controller: "books", action: "list", format: "xml")
+ assert_equal "/books/list", url_for(set, controller: "books", action: "list")
+ assert_equal "/books", url_for(set, controller: "books", action: "index")
assert_equal({controller: "books", action: "list", format: "rss"}, set.recognize_path("/books/list.rss"))
assert_equal({controller: "books", action: "list", format: "xml"}, set.recognize_path("/books/list.xml"))
@@ -1736,9 +1730,9 @@ class RouteSetTest < ActiveSupport::TestCase
def test_slashes_are_implied
set.draw { ActiveSupport::Deprecation.silence { get("/:controller(/:action(/:id))") } }
- assert_equal "/content", url_for(set, { controller: "content", action: "index" })
- assert_equal "/content/list", url_for(set, { controller: "content", action: "list" })
- assert_equal "/content/show/1", url_for(set, { controller: "content", action: "show", id: "1" })
+ assert_equal "/content", url_for(set, controller: "content", action: "index")
+ assert_equal "/content/list", url_for(set, controller: "content", action: "list")
+ assert_equal "/content/show/1", url_for(set, controller: "content", action: "show", id: "1")
assert_equal({controller: "content", action: "index"}, set.recognize_path("/content"))
assert_equal({controller: "content", action: "index"}, set.recognize_path("/content/index"))
@@ -1767,15 +1761,15 @@ class RouteSetTest < ActiveSupport::TestCase
end
def test_default_route_should_omit_default_action
- assert_equal "/accounts", url_for(default_route_set, { controller: "accounts", action: "index" })
+ assert_equal "/accounts", url_for(default_route_set, controller: "accounts", action: "index")
end
def test_default_route_should_include_default_action_when_id_present
- assert_equal "/accounts/index/20", url_for(default_route_set, { controller: "accounts", action: "index", id: "20" })
+ assert_equal "/accounts/index/20", url_for(default_route_set, controller: "accounts", action: "index", id: "20")
end
def test_default_route_should_work_with_action_but_no_id
- assert_equal "/accounts/list_all", url_for(default_route_set, { controller: "accounts", action: "list_all" })
+ assert_equal "/accounts/list_all", url_for(default_route_set, controller: "accounts", action: "list_all")
end
def test_default_route_should_uri_escape_pluses
@@ -1790,31 +1784,31 @@ class RouteSetTest < ActiveSupport::TestCase
end
def test_build_empty_query_string
- assert_uri_equal "/foo", url_for(default_route_set, { controller: "foo" })
+ assert_uri_equal "/foo", url_for(default_route_set, controller: "foo")
end
def test_build_query_string_with_nil_value
- assert_uri_equal "/foo", url_for(default_route_set, { controller: "foo", x: nil })
+ assert_uri_equal "/foo", url_for(default_route_set, controller: "foo", x: nil)
end
def test_simple_build_query_string
- assert_uri_equal "/foo?x=1&y=2", url_for(default_route_set, { controller: "foo", x: "1", y: "2" })
+ assert_uri_equal "/foo?x=1&y=2", url_for(default_route_set, controller: "foo", x: "1", y: "2")
end
def test_convert_ints_build_query_string
- assert_uri_equal "/foo?x=1&y=2", url_for(default_route_set, { controller: "foo", x: 1, y: 2 })
+ assert_uri_equal "/foo?x=1&y=2", url_for(default_route_set, controller: "foo", x: 1, y: 2)
end
def test_escape_spaces_build_query_string
- assert_uri_equal "/foo?x=hello+world&y=goodbye+world", url_for(default_route_set, { controller: "foo", x: "hello world", y: "goodbye world" })
+ assert_uri_equal "/foo?x=hello+world&y=goodbye+world", url_for(default_route_set, controller: "foo", x: "hello world", y: "goodbye world")
end
def test_expand_array_build_query_string
- assert_uri_equal "/foo?x%5B%5D=1&x%5B%5D=2", url_for(default_route_set, { controller: "foo", x: [1, 2] })
+ assert_uri_equal "/foo?x%5B%5D=1&x%5B%5D=2", url_for(default_route_set, controller: "foo", x: [1, 2])
end
def test_escape_spaces_build_query_string_selected_keys
- assert_uri_equal "/foo?x=hello+world", url_for(default_route_set, { controller: "foo", x: "hello world" })
+ assert_uri_equal "/foo?x=hello+world", url_for(default_route_set, controller: "foo", x: "hello world")
end
def test_generate_with_default_params
@@ -1830,7 +1824,7 @@ class RouteSetTest < ActiveSupport::TestCase
end
end
- assert_equal "/ibocorp", url_for(set, { controller: "ibocorp", action: "show", page: 1 })
+ assert_equal "/ibocorp", url_for(set, controller: "ibocorp", action: "show", page: 1)
end
include ActionDispatch::RoutingVerbs
@@ -1876,11 +1870,11 @@ class RouteSetTest < ActiveSupport::TestCase
get URI("http://example.org/blog/2006/07/28")
assert_equal({controller: "blog", action: "show_date", year: "2006", month: "07", day: "28"}, controller.request.path_parameters)
- assert_equal("/blog/2006/07/25", controller.url_for({ day: 25, only_path: true }))
- assert_equal("/blog/2005", controller.url_for({ year: 2005, only_path: true }))
- assert_equal("/blog/show/123", controller.url_for({ action: "show" , id: 123, only_path: true }))
- assert_equal("/blog/2006", controller.url_for({ year: 2006, only_path: true }))
- assert_equal("/blog/2006", controller.url_for({ year: 2006, month: nil, only_path: true }))
+ assert_equal("/blog/2006/07/25", controller.url_for(day: 25, only_path: true))
+ assert_equal("/blog/2005", controller.url_for(year: 2005, only_path: true))
+ assert_equal("/blog/show/123", controller.url_for(action: "show" , id: 123, only_path: true))
+ assert_equal("/blog/2006", controller.url_for(year: 2006, only_path: true))
+ assert_equal("/blog/2006", controller.url_for(year: 2006, month: nil, only_path: true))
end
private
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb
index d369514119..45bc770e86 100644
--- a/actionpack/test/controller/test_case_test.rb
+++ b/actionpack/test/controller/test_case_test.rb
@@ -273,7 +273,7 @@ XML
end
def test_deprecated_process_with_flash
- assert_deprecated { process :set_flash, "GET", nil, nil, { "test" => "value" } }
+ assert_deprecated { process :set_flash, "GET", nil, nil, "test" => "value" }
assert_equal ">value<", flash["test"]
end
@@ -285,7 +285,7 @@ XML
end
def test_deprecated_process_with_flash_now
- assert_deprecated { process :set_flash_now, "GET", nil, nil, { "test_now" => "value_now" } }
+ assert_deprecated { process :set_flash_now, "GET", nil, nil, "test_now" => "value_now" }
assert_equal ">value_now<", flash["test_now"]
end
@@ -312,7 +312,7 @@ XML
end
def test_process_with_session_arg
- assert_deprecated { process :no_op, "GET", nil, { "string" => "value1", symbol: "value2" } }
+ assert_deprecated { process :no_op, "GET", nil, "string" => "value1", symbol: "value2" }
assert_equal "value1", session["string"]
assert_equal "value1", session[:string]
assert_equal "value2", session["symbol"]
@@ -330,7 +330,7 @@ XML
def test_deprecated_process_merges_session_arg
session[:foo] = "bar"
assert_deprecated {
- get :no_op, nil, { bar: "baz" }
+ get :no_op, nil, bar: "baz"
}
assert_equal "bar", session[:foo]
assert_equal "baz", session[:bar]
@@ -345,7 +345,7 @@ XML
def test_deprecated_merged_session_arg_is_retained_across_requests
assert_deprecated {
- get :no_op, nil, { foo: "bar" }
+ get :no_op, nil, foo: "bar"
}
assert_equal "bar", session[:foo]
get :no_op
@@ -455,9 +455,9 @@ XML
def test_assert_generates
assert_generates "controller/action/5", controller: "controller", action: "action", id: "5"
- assert_generates "controller/action/7", { id: "7" }, { controller: "controller", action: "action" }
- assert_generates "controller/action/5", { controller: "controller", action: "action", id: "5", name: "bob" }, {}, { name: "bob" }
- assert_generates "controller/action/7", { id: "7", name: "bob" }, { controller: "controller", action: "action" }, { name: "bob" }
+ assert_generates "controller/action/7", { id: "7" }, controller: "controller", action: "action"
+ assert_generates "controller/action/5", { controller: "controller", action: "action", id: "5", name: "bob" }, {}, name: "bob"
+ assert_generates "controller/action/7", { id: "7", name: "bob" }, { controller: "controller", action: "action" }, name: "bob"
assert_generates "controller/action/7", { id: "7" }, { controller: "controller", action: "action", name: "bob" }, {}
end
@@ -468,7 +468,7 @@ XML
def test_assert_routing_with_method
with_routing do |set|
set.draw { resources(:content) }
- assert_routing({ method: "post", path: "content" }, { controller: "content", action: "create" })
+ assert_routing({ method: "post", path: "content" }, controller: "content", action: "create")
end
end
@@ -487,7 +487,7 @@ XML
def test_assert_routing_with_glob
with_routing do |set|
set.draw { get("*path" => "pages#show") }
- assert_routing("/company/about", { controller: "pages", action: "show", path: "company/about" })
+ assert_routing("/company/about", controller: "pages", action: "show", path: "company/about")
end
end
diff --git a/actionpack/test/controller/url_for_test.rb b/actionpack/test/controller/url_for_test.rb
index 6b0dd0ac88..ad4acf3462 100644
--- a/actionpack/test/controller/url_for_test.rb
+++ b/actionpack/test/controller/url_for_test.rb
@@ -29,9 +29,9 @@ module AbstractController
self.default_url_options[:host] = "example.com"
}
- path = klass.new.fun_path({controller: :articles,
+ path = klass.new.fun_path(controller: :articles,
baz: "baz",
- zot: "zot"})
+ zot: "zot")
# :bar key isn't provided
assert_equal "/foo/zot", path
end
@@ -230,21 +230,21 @@ module AbstractController
add_host!
options = { trailing_slash: true,protocol: "https", controller: "foo", action: "bar", id: "33"}
assert_equal("https://www.basecamphq.com/foo/bar/33/", W.new.url_for(options) )
- assert_equal "https://www.basecamphq.com/foo/bar/33/?query=string", W.new.url_for(options.merge({query: "string"}))
+ assert_equal "https://www.basecamphq.com/foo/bar/33/?query=string", W.new.url_for(options.merge(query: "string"))
end
def test_trailing_slash_with_only_path
options = {controller: "foo", trailing_slash: true}
- assert_equal "/foo/", W.new.url_for(options.merge({only_path: true}))
- options.update({action: "bar", id: "33"})
- assert_equal "/foo/bar/33/", W.new.url_for(options.merge({only_path: true}))
- assert_equal "/foo/bar/33/?query=string", W.new.url_for(options.merge({query: "string",only_path: true}))
+ assert_equal "/foo/", W.new.url_for(options.merge(only_path: true))
+ options.update(action: "bar", id: "33")
+ assert_equal "/foo/bar/33/", W.new.url_for(options.merge(only_path: true))
+ assert_equal "/foo/bar/33/?query=string", W.new.url_for(options.merge(query: "string",only_path: true))
end
def test_trailing_slash_with_anchor
options = {trailing_slash: true, controller: "foo", action: "bar", id: "33", only_path: true, anchor: "chapter7"}
assert_equal "/foo/bar/33/#chapter7", W.new.url_for(options)
- assert_equal "/foo/bar/33/?query=string#chapter7", W.new.url_for(options.merge({query: "string"}))
+ assert_equal "/foo/bar/33/?query=string#chapter7", W.new.url_for(options.merge(query: "string"))
end
def test_trailing_slash_with_params
diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb
index 5f481c1edb..81dc230929 100644
--- a/actionpack/test/controller/url_rewriter_test.rb
+++ b/actionpack/test/controller/url_rewriter_test.rb
@@ -81,10 +81,10 @@ class UrlRewriterTests < ActionController::TestCase
def test_trailing_slash
options = {controller: "foo", action: "bar", id: "3", only_path: true}
assert_equal "/foo/bar/3", @rewriter.rewrite(@routes, options)
- assert_equal "/foo/bar/3?query=string", @rewriter.rewrite(@routes, options.merge({query: "string"}))
- options.update({trailing_slash: true})
+ assert_equal "/foo/bar/3?query=string", @rewriter.rewrite(@routes, options.merge(query: "string"))
+ options.update(trailing_slash: true)
assert_equal "/foo/bar/3/", @rewriter.rewrite(@routes, options)
- options.update({query: "string"})
+ options.update(query: "string")
assert_equal "/foo/bar/3/?query=string", @rewriter.rewrite(@routes, options)
end
end
diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb
index 671009c090..6f97a4b62e 100644
--- a/actionpack/test/controller/webservice_test.rb
+++ b/actionpack/test/controller/webservice_test.rb
@@ -103,7 +103,7 @@ class WebServiceTest < ActionDispatch::IntegrationTest
end
def content_length; get_header("rack.input").length; end
- end.new({ "rack.input" => StringIO.new('{"title":"JSON"}}'), "CONTENT_TYPE" => "application/json" })
+ end.new("rack.input" => StringIO.new('{"title":"JSON"}}'), "CONTENT_TYPE" => "application/json")
assert_raises(Interrupt) do
req.request_parameters
diff --git a/actionpack/test/dispatch/callbacks_test.rb b/actionpack/test/dispatch/callbacks_test.rb
index 300f7b7a16..ca3154e16e 100644
--- a/actionpack/test/dispatch/callbacks_test.rb
+++ b/actionpack/test/dispatch/callbacks_test.rb
@@ -57,7 +57,7 @@ class DispatcherTest < ActiveSupport::TestCase
def dispatch(&block)
ActionDispatch::Callbacks.new(block || DummyApp.new).call(
- {"rack.input" => StringIO.new("")}
+ "rack.input" => StringIO.new("")
)
end
diff --git a/actionpack/test/dispatch/executor_test.rb b/actionpack/test/dispatch/executor_test.rb
index 1d5a554903..0b4e0849c3 100644
--- a/actionpack/test/dispatch/executor_test.rb
+++ b/actionpack/test/dispatch/executor_test.rb
@@ -120,7 +120,7 @@ class ExecutorTest < ActiveSupport::TestCase
private
def call_and_return_body(&block)
app = middleware(block || proc { [200, {}, "response"] })
- _, _, body = app.call({"rack.input" => StringIO.new("")})
+ _, _, body = app.call("rack.input" => StringIO.new(""))
body
end
diff --git a/actionpack/test/dispatch/rack_cache_test.rb b/actionpack/test/dispatch/rack_cache_test.rb
index e421cbdbce..d7bb90abbf 100644
--- a/actionpack/test/dispatch/rack_cache_test.rb
+++ b/actionpack/test/dispatch/rack_cache_test.rb
@@ -12,7 +12,7 @@ class RackCacheMetaStoreTest < ActiveSupport::TestCase
end
test "stuff is deep duped" do
- @store.write(:foo, { bar: :original })
+ @store.write(:foo, bar: :original)
hash = @store.read(:foo)
hash[:bar] = :changed
hash = @store.read(:foo)
diff --git a/actionpack/test/dispatch/reloader_test.rb b/actionpack/test/dispatch/reloader_test.rb
index 5dd3414958..761237d5dc 100644
--- a/actionpack/test/dispatch/reloader_test.rb
+++ b/actionpack/test/dispatch/reloader_test.rb
@@ -198,6 +198,6 @@ class ReloaderTest < ActiveSupport::TestCase
@response ||= "response"
@reloader ||= Reloader.new(block || proc {[200, {}, @response]}, x)
- @reloader.call({"rack.input" => StringIO.new("")})[2]
+ @reloader.call("rack.input" => StringIO.new(""))[2]
end
end
diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb
index 20e16dc0c2..e24b1e12e3 100644
--- a/actionpack/test/dispatch/request/json_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb
@@ -19,43 +19,43 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest
test "parses json params for application json" do
assert_parses(
{"person" => {"name" => "David"}},
- "{\"person\": {\"name\": \"David\"}}", { "CONTENT_TYPE" => "application/json" }
+ "{\"person\": {\"name\": \"David\"}}", "CONTENT_TYPE" => "application/json"
)
end
test "parses boolean and number json params for application json" do
assert_parses(
{"item" => {"enabled" => false, "count" => 10}},
- "{\"item\": {\"enabled\": false, \"count\": 10}}", { "CONTENT_TYPE" => "application/json" }
+ "{\"item\": {\"enabled\": false, \"count\": 10}}", "CONTENT_TYPE" => "application/json"
)
end
test "parses json params for application jsonrequest" do
assert_parses(
{"person" => {"name" => "David"}},
- "{\"person\": {\"name\": \"David\"}}", { "CONTENT_TYPE" => "application/jsonrequest" }
+ "{\"person\": {\"name\": \"David\"}}", "CONTENT_TYPE" => "application/jsonrequest"
)
end
test "does not parse unregistered media types such as application/vnd.api+json" do
assert_parses(
{},
- "{\"person\": {\"name\": \"David\"}}", { "CONTENT_TYPE" => "application/vnd.api+json" }
+ "{\"person\": {\"name\": \"David\"}}", "CONTENT_TYPE" => "application/vnd.api+json"
)
end
test "nils are stripped from collections" do
assert_parses(
{"person" => []},
- "{\"person\":[null]}", { "CONTENT_TYPE" => "application/json" }
+ "{\"person\":[null]}", "CONTENT_TYPE" => "application/json"
)
assert_parses(
{"person" => ["foo"]},
- "{\"person\":[\"foo\",null]}", { "CONTENT_TYPE" => "application/json" }
+ "{\"person\":[\"foo\",null]}", "CONTENT_TYPE" => "application/json"
)
assert_parses(
{"person" => []},
- "{\"person\":[null, null]}", { "CONTENT_TYPE" => "application/json" }
+ "{\"person\":[null, null]}", "CONTENT_TYPE" => "application/json"
)
end
@@ -75,7 +75,7 @@ class JsonParamsParsingTest < ActionDispatch::IntegrationTest
begin
$stderr = StringIO.new # suppress the log
json = "[\"person]\": {\"name\": \"David\"}}"
- exception = assert_raise(ActionDispatch::ParamsParser::ParseError) { post "/parse", json, {"CONTENT_TYPE" => "application/json", "action_dispatch.show_exceptions" => false} }
+ exception = assert_raise(ActionDispatch::ParamsParser::ParseError) { post "/parse", json, "CONTENT_TYPE" => "application/json", "action_dispatch.show_exceptions" => false }
assert_equal JSON::ParserError, exception.cause.class
assert_equal exception.cause.message, exception.message
ensure
@@ -134,21 +134,21 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest
test "parses json params for application json" do
assert_parses(
{"user" => {"username" => "sikachu"}, "username" => "sikachu"},
- "{\"username\": \"sikachu\"}", { "CONTENT_TYPE" => "application/json" }
+ "{\"username\": \"sikachu\"}", "CONTENT_TYPE" => "application/json"
)
end
test "parses json params for application jsonrequest" do
assert_parses(
{"user" => {"username" => "sikachu"}, "username" => "sikachu"},
- "{\"username\": \"sikachu\"}", { "CONTENT_TYPE" => "application/jsonrequest" }
+ "{\"username\": \"sikachu\"}", "CONTENT_TYPE" => "application/jsonrequest"
)
end
test "parses json with non-object JSON content" do
assert_parses(
{"user" => {"_json" => "string content" }, "_json" => "string content" },
- "\"string content\"", { "CONTENT_TYPE" => "application/json" }
+ "\"string content\"", "CONTENT_TYPE" => "application/json"
)
end
@@ -158,7 +158,7 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest
Mime::Type.register "application/json", :json, %w(application/vnd.rails+json)
assert_parses(
{"user" => {"username" => "meinac"}, "username" => "meinac"},
- "{\"username\": \"meinac\"}", { "CONTENT_TYPE" => "application/json" }
+ "{\"username\": \"meinac\"}", "CONTENT_TYPE" => "application/json"
)
ensure
Mime::Type.unregister :json
@@ -172,7 +172,7 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest
Mime::Type.register "application/json", :json, %w(application/vnd.rails+json)
assert_parses(
{"user" => {"username" => "meinac"}, "username" => "meinac"},
- "{\"username\": \"meinac\"}", { "CONTENT_TYPE" => "application/vnd.rails+json" }
+ "{\"username\": \"meinac\"}", "CONTENT_TYPE" => "application/vnd.rails+json"
)
ensure
Mime::Type.unregister :json
@@ -186,7 +186,7 @@ class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest
post "/parse", params: actual, headers: headers
assert_response :ok
assert_equal(expected, UsersController.last_request_parameters)
- assert_equal(expected.merge({"action" => "parse"}), UsersController.last_parameters)
+ assert_equal(expected.merge("action" => "parse"), UsersController.last_parameters)
end
end
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 1efcd9e97f..d539092244 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -291,7 +291,7 @@ class ResponseTest < ActiveSupport::TestCase
test "read content type with default charset utf-8" do
original = ActionDispatch::Response.default_charset
begin
- resp = ActionDispatch::Response.new(200, { "Content-Type" => "text/xml" })
+ resp = ActionDispatch::Response.new(200, "Content-Type" => "text/xml")
assert_equal("utf-8", resp.charset)
ensure
ActionDispatch::Response.default_charset = original
@@ -302,7 +302,7 @@ class ResponseTest < ActiveSupport::TestCase
original = ActionDispatch::Response.default_charset
begin
ActionDispatch::Response.default_charset = "utf-16"
- resp = ActionDispatch::Response.new(200, { "Content-Type" => "text/xml" })
+ resp = ActionDispatch::Response.new(200, "Content-Type" => "text/xml")
assert_equal("utf-16", resp.charset)
ensure
ActionDispatch::Response.default_charset = original
diff --git a/actionpack/test/dispatch/routing_assertions_test.rb b/actionpack/test/dispatch/routing_assertions_test.rb
index 1e77c7311e..1f8ce059d1 100644
--- a/actionpack/test/dispatch/routing_assertions_test.rb
+++ b/actionpack/test/dispatch/routing_assertions_test.rb
@@ -27,16 +27,16 @@ class RoutingAssertionsTest < ActionController::TestCase
end
def test_assert_generates
- assert_generates("/articles", { controller: "articles", action: "index" })
- assert_generates("/articles/1", { controller: "articles", action: "show", id: "1" })
+ assert_generates("/articles", controller: "articles", action: "index")
+ assert_generates("/articles/1", controller: "articles", action: "show", id: "1")
end
def test_assert_generates_with_defaults
- assert_generates("/articles/1/edit", { controller: "articles", action: "edit" }, { id: "1" })
+ assert_generates("/articles/1/edit", { controller: "articles", action: "edit" }, id: "1")
end
def test_assert_generates_with_extras
- assert_generates("/articles", { controller: "articles", action: "index", page: "1" }, {}, { page: "1" })
+ assert_generates("/articles", { controller: "articles", action: "index", page: "1" }, {}, page: "1")
end
def test_assert_recognizes
@@ -45,12 +45,12 @@ class RoutingAssertionsTest < ActionController::TestCase
end
def test_assert_recognizes_with_extras
- assert_recognizes({ controller: "articles", action: "index", page: "1" }, "/articles", { page: "1" })
+ assert_recognizes({ controller: "articles", action: "index", page: "1" }, "/articles", page: "1")
end
def test_assert_recognizes_with_method
- assert_recognizes({ controller: "articles", action: "create" }, { path: "/articles", method: :post })
- assert_recognizes({ controller: "articles", action: "update", id: "1" }, { path: "/articles/1", method: :put })
+ assert_recognizes({ controller: "articles", action: "create" }, path: "/articles", method: :post)
+ assert_recognizes({ controller: "articles", action: "update", id: "1" }, path: "/articles/1", method: :put)
end
def test_assert_recognizes_with_hash_constraint
@@ -69,9 +69,9 @@ class RoutingAssertionsTest < ActionController::TestCase
def test_assert_recognizes_with_query_constraint
assert_raise(Assertion) do
- assert_recognizes({ controller: "query_articles", action: "index", use_query: "false" }, "/query/articles", { use_query: "false" })
+ assert_recognizes({ controller: "query_articles", action: "index", use_query: "false" }, "/query/articles", use_query: "false")
end
- assert_recognizes({ controller: "query_articles", action: "index", use_query: "true" }, "/query/articles", { use_query: "true" })
+ assert_recognizes({ controller: "query_articles", action: "index", use_query: "true" }, "/query/articles", use_query: "true")
end
def test_assert_recognizes_raises_message
@@ -95,25 +95,25 @@ class RoutingAssertionsTest < ActionController::TestCase
end
def test_assert_routing_with_defaults
- assert_routing("/articles/1/edit", { controller: "articles", action: "edit", id: "1" }, { id: "1" })
+ assert_routing("/articles/1/edit", { controller: "articles", action: "edit", id: "1" }, id: "1")
end
def test_assert_routing_with_extras
- assert_routing("/articles", { controller: "articles", action: "index", page: "1" }, { }, { page: "1" })
+ assert_routing("/articles", { controller: "articles", action: "index", page: "1" }, { }, page: "1")
end
def test_assert_routing_with_hash_constraint
assert_raise(Assertion) do
- assert_routing("http://test.host/secure/articles", { controller: "secure_articles", action: "index" })
+ assert_routing("http://test.host/secure/articles", controller: "secure_articles", action: "index")
end
- assert_routing("https://test.host/secure/articles", { controller: "secure_articles", action: "index", protocol: "https://" })
+ assert_routing("https://test.host/secure/articles", controller: "secure_articles", action: "index", protocol: "https://")
end
def test_assert_routing_with_block_constraint
assert_raise(Assertion) do
- assert_routing("http://test.host/block/articles", { controller: "block_articles", action: "index" })
+ assert_routing("http://test.host/block/articles", controller: "block_articles", action: "index")
end
- assert_routing("https://test.host/block/articles", { controller: "block_articles", action: "index" })
+ assert_routing("https://test.host/block/articles", controller: "block_articles", action: "index")
end
def test_with_routing
@@ -124,7 +124,7 @@ class RoutingAssertionsTest < ActionController::TestCase
assert_routing("/artikel", controller: "articles", action: "index")
assert_raise(Assertion) do
- assert_routing("/articles", { controller: "articles", action: "index" })
+ assert_routing("/articles", controller: "articles", action: "index")
end
end
end
diff --git a/actionpack/test/journey/route_test.rb b/actionpack/test/journey/route_test.rb
index 5364f9de81..cce5c2ae37 100644
--- a/actionpack/test/journey/route_test.rb
+++ b/actionpack/test/journey/route_test.rb
@@ -35,57 +35,53 @@ module ActionDispatch
def test_ip_address
path = Path::Pattern.from_string "/messages/:id(.:format)"
route = Route.build("name", nil, path, {ip: "192.168.1.1"}, [],
- { controller: "foo", action: "bar" })
+ controller: "foo", action: "bar")
assert_equal "192.168.1.1", route.ip
end
def test_default_ip
path = Path::Pattern.from_string "/messages/:id(.:format)"
route = Route.build("name", nil, path, {}, [],
- { controller: "foo", action: "bar" })
+ controller: "foo", action: "bar")
assert_equal(//, route.ip)
end
def test_format_with_star
path = Path::Pattern.from_string "/:controller/*extra"
route = Route.build("name", nil, path, {}, [],
- { controller: "foo", action: "bar" })
- assert_equal "/foo/himom", route.format({
- controller: "foo",
- extra: "himom",
- })
+ controller: "foo", action: "bar")
+ assert_equal "/foo/himom", route.format( controller: "foo",
+ extra: "himom")
end
def test_connects_all_match
path = Path::Pattern.from_string "/:controller(/:action(/:id(.:format)))"
- route = Route.build("name", nil, path, {action: "bar"}, [], { controller: "foo" })
+ route = Route.build("name", nil, path, {action: "bar"}, [], controller: "foo")
- assert_equal "/foo/bar/10", route.format({
- controller: "foo",
+ assert_equal "/foo/bar/10", route.format( controller: "foo",
action: "bar",
- id: 10
- })
+ id: 10)
end
def test_extras_are_not_included_if_optional
path = Path::Pattern.from_string "/page/:id(/:action)"
- route = Route.build("name", nil, path, { }, [], { action: "show" })
+ route = Route.build("name", nil, path, { }, [], action: "show")
- assert_equal "/page/10", route.format({ id: 10 })
+ assert_equal "/page/10", route.format(id: 10)
end
def test_extras_are_not_included_if_optional_with_parameter
path = Path::Pattern.from_string "(/sections/:section)/pages/:id"
- route = Route.build("name", nil, path, { }, [], { action: "show" })
+ route = Route.build("name", nil, path, { }, [], action: "show")
- assert_equal "/pages/10", route.format({id: 10})
+ assert_equal "/pages/10", route.format(id: 10)
end
def test_extras_are_not_included_if_optional_parameter_is_nil
path = Path::Pattern.from_string "(/sections/:section)/pages/:id"
- route = Route.build("name", nil, path, { }, [], { action: "show" })
+ route = Route.build("name", nil, path, { }, [], action: "show")
- assert_equal "/pages/10", route.format({id: 10, section: nil})
+ assert_equal "/pages/10", route.format(id: 10, section: nil)
end
def test_score
diff --git a/actionpack/test/journey/router_test.rb b/actionpack/test/journey/router_test.rb
index 97d3bc9845..83cd999352 100644
--- a/actionpack/test/journey/router_test.rb
+++ b/actionpack/test/journey/router_test.rb
@@ -109,7 +109,7 @@ module ActionDispatch
def test_X_Cascade
get "/messages(.:format)", to: "foo#bar"
- resp = router.serve(rails_env({ "REQUEST_METHOD" => "GET", "PATH_INFO" => "/lol" }))
+ resp = router.serve(rails_env("REQUEST_METHOD" => "GET", "PATH_INFO" => "/lol"))
assert_equal ["Not Found"], resp.last
assert_equal "pass", resp[1]["X-Cascade"]
assert_equal 404, resp.first
@@ -184,14 +184,14 @@ module ActionDispatch
def test_required_part_in_recall
get "/messages/:a/:b", to: "foo#bar"
- path, _ = @formatter.generate(nil, { controller: "foo", action: "bar", a: "a" }, { b: "b" })
+ path, _ = @formatter.generate(nil, { controller: "foo", action: "bar", a: "a" }, b: "b")
assert_equal "/messages/a/b", path
end
def test_splat_in_recall
get "/*path", to: "foo#bar"
- path, _ = @formatter.generate(nil, { controller: "foo", action: "bar" }, { path: "b" })
+ path, _ = @formatter.generate(nil, { controller: "foo", action: "bar" }, path: "b")
assert_equal "/b", path
end
@@ -199,7 +199,7 @@ module ActionDispatch
get "/messages/:action(/:id(.:format))", to: "foo#bar"
get "/messages/:id(.:format)", to: "bar#baz"
- path, _ = @formatter.generate(nil, { controller: "foo", id: 10 }, { action: "index" })
+ path, _ = @formatter.generate(nil, { controller: "foo", id: 10 }, action: "index")
assert_equal "/messages/index/10", path
end
@@ -312,7 +312,7 @@ module ActionDispatch
path, params = @formatter.generate(
nil,
{controller: "tasks", id: 10},
- {action: "index"})
+ action: "index")
assert_equal "/tasks/index/10", path
assert_equal({}, params)
end
@@ -323,7 +323,7 @@ module ActionDispatch
path, params = @formatter.generate(
"tasks",
{controller: "tasks"},
- {controller: "tasks", action: "index"})
+ controller: "tasks", action: "index")
assert_equal "/tasks", path
assert_equal({}, params)
end
@@ -372,7 +372,7 @@ module ActionDispatch
end
def test_namespaced_controller
- get "/:controller(/:action(/:id))", { controller: /.+?/ }
+ get "/:controller(/:action(/:id))", controller: /.+?/
route = @routes.first
env = rails_env "PATH_INFO" => "/admin/users/show/10"
diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb
index 26b72a09e8..92989dfbe8 100644
--- a/actionview/test/abstract_unit.rb
+++ b/actionview/test/abstract_unit.rb
@@ -137,7 +137,7 @@ class BasicController
config.assets_dir = public_dir
config.javascripts_dir = "#{public_dir}/javascripts"
config.stylesheets_dir = "#{public_dir}/stylesheets"
- config.assets = ActiveSupport::InheritableOptions.new({ prefix: "assets" })
+ config.assets = ActiveSupport::InheritableOptions.new(prefix: "assets")
config
end
end
diff --git a/actionview/test/actionpack/controller/view_paths_test.rb b/actionview/test/actionpack/controller/view_paths_test.rb
index 0ce515bba5..e676a2ecd4 100644
--- a/actionview/test/actionpack/controller/view_paths_test.rb
+++ b/actionview/test/actionpack/controller/view_paths_test.rb
@@ -131,10 +131,8 @@ class ViewLoadPathsTest < ActionController::TestCase
"Decorated body",
template.identifier,
template.handler,
- {
- virtual_path: template.virtual_path,
+ virtual_path: template.virtual_path,
format: template.formats
- }
)
end
end
diff --git a/actionview/test/activerecord/polymorphic_routes_test.rb b/actionview/test/activerecord/polymorphic_routes_test.rb
index 1aac4b9c56..952ed72aa9 100644
--- a/actionview/test/activerecord/polymorphic_routes_test.rb
+++ b/actionview/test/activerecord/polymorphic_routes_test.rb
@@ -179,7 +179,7 @@ class PolymorphicRoutesTest < ActionController::TestCase
def test_with_nil_id
with_test_routes do
exception = assert_raise ArgumentError do
- polymorphic_url({ id: nil })
+ polymorphic_url(id: nil)
end
assert_equal "Nil location provided. Can't build URI.", exception.message
end
@@ -233,8 +233,8 @@ class PolymorphicRoutesTest < ActionController::TestCase
def test_class_with_options
with_test_routes do
- assert_equal "http://example.com/projects?foo=bar", polymorphic_url(@project.class, { foo: :bar })
- assert_equal "/projects?foo=bar", polymorphic_path(@project.class, { foo: :bar })
+ assert_equal "http://example.com/projects?foo=bar", polymorphic_url(@project.class, foo: :bar)
+ assert_equal "/projects?foo=bar", polymorphic_path(@project.class, foo: :bar)
end
end
diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb
index c74e3549bf..0f1f22c43a 100644
--- a/actionview/test/template/date_helper_test.rb
+++ b/actionview/test/template/date_helper_test.rb
@@ -667,7 +667,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="15">15</option>\n<option value="30">30</option>\n<option value="45">45</option>\n)
expected << "</select>\n"
- assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), { include_blank: true , minute_step: 15 })
+ assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), include_blank: true , minute_step: 15)
end
def test_select_minute_nil_with_blank
@@ -683,7 +683,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="15">15</option>\n<option value="30">30</option>\n<option value="45">45</option>\n)
expected << "</select>\n"
- assert_dom_equal expected, select_minute(nil, { include_blank: true , minute_step: 15 })
+ assert_dom_equal expected, select_minute(nil, include_blank: true , minute_step: 15)
end
def test_select_minute_with_hidden
@@ -1066,7 +1066,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
expected << "</select>\n"
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { date_separator: " / ", start_year: 2003, end_year: 2005, prefix: "date[first]"})
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), date_separator: " / ", start_year: 2003, end_year: 2005, prefix: "date[first]")
end
def test_select_date_with_separator_and_discard_day
@@ -1082,7 +1082,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<input type="hidden" id="date_first_day" name="date[first][day]" value="1" />\n)
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { date_separator: " / ", discard_day: true, start_year: 2003, end_year: 2005, prefix: "date[first]"})
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), date_separator: " / ", discard_day: true, start_year: 2003, end_year: 2005, prefix: "date[first]")
end
def test_select_date_with_separator_discard_month_and_day
@@ -1093,7 +1093,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<input type="hidden" id="date_first_month" name="date[first][month]" value="8" />\n)
expected << %(<input type="hidden" id="date_first_day" name="date[first][day]" value="1" />\n)
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { date_separator: " / ", discard_month: true, discard_day: true, start_year: 2003, end_year: 2005, prefix: "date[first]"})
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), date_separator: " / ", discard_month: true, discard_day: true, start_year: 2003, end_year: 2005, prefix: "date[first]")
end
def test_select_date_with_hidden
@@ -1101,8 +1101,8 @@ class DateHelperTest < ActionView::TestCase
expected << %(<input id="date_first_month" name="date[first][month]" type="hidden" value="8" />\n)
expected << %(<input id="date_first_day" name="date[first][day]" type="hidden" value="16" />\n)
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { prefix: "date[first]", use_hidden: true })
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { date_separator: " / ", prefix: "date[first]", use_hidden: true })
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), prefix: "date[first]", use_hidden: true)
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), date_separator: " / ", prefix: "date[first]", use_hidden: true)
end
def test_select_date_with_css_classes_option
@@ -1118,7 +1118,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
expected << "</select>\n"
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, prefix: "date[first]", with_css_classes: true})
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), start_year: 2003, end_year: 2005, prefix: "date[first]", with_css_classes: true)
end
def test_select_date_with_custom_with_css_classes
@@ -1150,7 +1150,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
expected << "</select>\n"
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, prefix: "date[first]", with_css_classes: true}, { class: "datetime optional" })
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, prefix: "date[first]", with_css_classes: true}, class: "datetime optional")
end
def test_select_date_with_custom_with_css_classes_and_html_class_option
@@ -1166,7 +1166,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
expected << "</select>\n"
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, with_css_classes: { year: "my-year", month: "my-month", day: "my-day" }}, { class: "date optional" })
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, with_css_classes: { year: "my-year", month: "my-month", day: "my-day" }}, class: "date optional")
end
def test_select_date_with_partial_with_css_classes_and_html_class_option
@@ -1182,7 +1182,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
expected << "</select>\n"
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, with_css_classes: { month: "my-month custom-grid" }}, { class: "date optional" })
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, with_css_classes: { month: "my-month custom-grid" }}, class: "date optional")
end
def test_select_date_with_html_class_option
@@ -1198,7 +1198,7 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
expected << "</select>\n"
- assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { start_year: 2003, end_year: 2005 }, { class: "date optional custom-grid" })
+ assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { start_year: 2003, end_year: 2005 }, class: "date optional custom-grid")
end
def test_select_datetime
@@ -2201,7 +2201,7 @@ class DateHelperTest < ActionView::TestCase
expected << "</select>\n"
- assert_dom_equal expected, date_select("post", "written_on", { date_separator: " / " })
+ assert_dom_equal expected, date_select("post", "written_on", date_separator: " / ")
end
def test_date_select_with_separator_and_order
@@ -2224,7 +2224,7 @@ class DateHelperTest < ActionView::TestCase
expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n}
expected << "</select>\n"
- assert_dom_equal expected, date_select("post", "written_on", { order: [:day, :month, :year], date_separator: " / " })
+ assert_dom_equal expected, date_select("post", "written_on", order: [:day, :month, :year], date_separator: " / ")
end
def test_date_select_with_separator_and_order_and_year_discarded
@@ -2242,7 +2242,7 @@ class DateHelperTest < ActionView::TestCase
expected << "</select>\n"
expected << %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n}
- assert_dom_equal expected, date_select("post", "written_on", { order: [:day, :month, :year], discard_year: true, date_separator: " / " })
+ assert_dom_equal expected, date_select("post", "written_on", order: [:day, :month, :year], discard_year: true, date_separator: " / ")
end
def test_date_select_with_default_prompt
@@ -2486,7 +2486,7 @@ class DateHelperTest < ActionView::TestCase
0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 35}>#{sprintf("%02d", i)}</option>\n) }
expected << "</select>\n"
- assert_dom_equal expected, time_select("post", "written_on", { time_separator: " - ", include_seconds: true })
+ assert_dom_equal expected, time_select("post", "written_on", time_separator: " - ", include_seconds: true)
end
def test_time_select_with_default_prompt
@@ -2773,7 +2773,7 @@ class DateHelperTest < ActionView::TestCase
0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 35}>#{sprintf("%02d", i)}</option>\n) }
expected << "</select>\n"
- assert_dom_equal expected, datetime_select("post", "updated_at", { date_separator: " / ", datetime_separator: " , ", time_separator: " - ", include_seconds: true })
+ assert_dom_equal expected, datetime_select("post", "updated_at", date_separator: " / ", datetime_separator: " , ", time_separator: " - ", include_seconds: true)
end
def test_datetime_select_with_integer
diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb
index 7547026dd1..dec75268aa 100644
--- a/actionview/test/template/digestor_test.rb
+++ b/actionview/test/template/digestor_test.rb
@@ -216,7 +216,7 @@ class TemplateDigestorTest < ActionView::TestCase
def test_details_are_included_in_cache_key
# Cache the template digest.
- @finder = FixtureFinder.new({formats: [:html]})
+ @finder = FixtureFinder.new(formats: [:html])
old_digest = digest("events/_event")
# Change the template; the cached digest remains unchanged.
diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb
index 10f7ce90ee..9eb4d8f58f 100644
--- a/actionview/test/template/form_collections_helper_test.rb
+++ b/actionview/test/template/form_collections_helper_test.rb
@@ -207,14 +207,14 @@ class FormCollectionsHelperTest < ActionView::TestCase
test "collection radio buttons generates a hidden field using the given :name in :html_options" do
collection = [Category.new(1, "Category 1"), Category.new(2, "Category 2")]
- with_collection_radio_buttons :user, :category_ids, collection, :id, :name, {}, { name: "user[other_category_ids]" }
+ with_collection_radio_buttons :user, :category_ids, collection, :id, :name, {}, name: "user[other_category_ids]"
assert_select "input[type=hidden][name='user[other_category_ids]'][value='']", count: 1
end
test "collection radio buttons generates a hidden field with index if it was provided" do
collection = [Category.new(1, "Category 1"), Category.new(2, "Category 2")]
- with_collection_radio_buttons :user, :category_ids, collection, :id, :name, { index: 322 }
+ with_collection_radio_buttons :user, :category_ids, collection, :id, :name, index: 322
assert_select "input[type=hidden][name='user[322][category_ids]'][value='']", count: 1
end
@@ -251,14 +251,14 @@ class FormCollectionsHelperTest < ActionView::TestCase
test "collection check boxes generates a hidden field using the given :name in :html_options" do
collection = [Category.new(1, "Category 1"), Category.new(2, "Category 2")]
- with_collection_check_boxes :user, :category_ids, collection, :id, :name, {}, {name: "user[other_category_ids][]"}
+ with_collection_check_boxes :user, :category_ids, collection, :id, :name, {}, name: "user[other_category_ids][]"
assert_select "input[type=hidden][name='user[other_category_ids][]'][value='']", count: 1
end
test "collection check boxes generates a hidden field with index if it was provided" do
collection = [Category.new(1, "Category 1"), Category.new(2, "Category 2")]
- with_collection_check_boxes :user, :category_ids, collection, :id, :name, { index: 322 }
+ with_collection_check_boxes :user, :category_ids, collection, :id, :name, index: 322
assert_select "input[type=hidden][name='user[322][category_ids][]'][value='']", count: 1
end
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb
index e40b104c8d..716cb3a00a 100644
--- a/actionview/test/template/form_helper_test.rb
+++ b/actionview/test/template/form_helper_test.rb
@@ -16,8 +16,7 @@ class FormHelperTest < ActionView::TestCase
setup do
# Create "label" locale for testing I18n label helpers
- I18n.backend.store_translations "label", {
- activemodel: {
+ I18n.backend.store_translations "label", activemodel: {
attributes: {
post: {
cost: "Total cost"
@@ -46,11 +45,9 @@ class FormHelperTest < ActionView::TestCase
}
}
}
- }
# Create "submit" locale for testing I18n submit helpers
- I18n.backend.store_translations "submit", {
- helpers: {
+ I18n.backend.store_translations "submit", helpers: {
submit: {
create: "Create %{model}",
update: "Confirm %{model} changes",
@@ -60,10 +57,8 @@ class FormHelperTest < ActionView::TestCase
}
}
}
- }
- I18n.backend.store_translations "placeholder", {
- activemodel: {
+ I18n.backend.store_translations "placeholder", activemodel: {
attributes: {
post: {
cost: "Total cost"
@@ -92,7 +87,6 @@ class FormHelperTest < ActionView::TestCase
}
}
}
- }
@post = Post.new
@comment = Comment.new
@@ -776,7 +770,7 @@ class FormHelperTest < ActionView::TestCase
def test_checkbox_disabled_disables_hidden_field
assert_dom_equal(
'<input name="post[secret]" type="hidden" value="0" disabled="disabled"/><input checked="checked" disabled="disabled" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
- check_box("post", "secret", { disabled: true })
+ check_box("post", "secret", disabled: true)
)
end
diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb
index 948887742d..69c43dacb0 100644
--- a/actionview/test/template/form_options_helper_test.rb
+++ b/actionview/test/template/form_options_helper_test.rb
@@ -388,7 +388,7 @@ class FormOptionsHelperTest < ActionView::TestCase
def test_optgroups_with_with_options_with_hash
assert_dom_equal(
"<optgroup label=\"North America\"><option value=\"United States\">United States</option>\n<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>\n<option value=\"Germany\">Germany</option></optgroup>",
- grouped_options_for_select({"North America" => ["United States","Canada"], "Europe" => ["Denmark","Germany"]})
+ grouped_options_for_select("North America" => ["United States","Canada"], "Europe" => ["Denmark","Germany"])
)
end
@@ -752,7 +752,7 @@ class FormOptionsHelperTest < ActionView::TestCase
@post.category = ""
assert_dom_equal(
"<select class=\"disabled\" disabled=\"disabled\" name=\"post[category]\" id=\"post_category\"><option value=\"\">Please select</option>\n<option value=\"\"></option>\n</select>",
- select("post", "category", [], { prompt: true, include_blank: true }, { class: "disabled", disabled: true })
+ select("post", "category", [], { prompt: true, include_blank: true }, class: "disabled", disabled: true)
)
end
@@ -842,7 +842,7 @@ class FormOptionsHelperTest < ActionView::TestCase
assert_dom_equal(
expected,
- select("album[]", "genre", %w[rap rock country], {}, { index: nil })
+ select("album[]", "genre", %w[rap rock country], {}, index: nil)
)
end
@@ -997,7 +997,7 @@ class FormOptionsHelperTest < ActionView::TestCase
assert_dom_equal(
%{<select id="post_author_name" name="post[author_name]"><option value=""></option>\n<option value="&lt;Abe&gt;" selected="selected">&lt;Abe&gt;</option>\n<option value="Babe">Babe</option>\n<option value="Cabe">Cabe</option></select>},
- collection_select("post", "author_name", dummy_posts, "author_name", "author_name", {include_blank: true, selected: "<Abe>"})
+ collection_select("post", "author_name", dummy_posts, "author_name", "author_name", include_blank: true, selected: "<Abe>")
)
end
diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb
index f94dd21c71..603fddc09e 100644
--- a/actionview/test/template/form_tag_helper_test.rb
+++ b/actionview/test/template/form_tag_helper_test.rb
@@ -88,25 +88,25 @@ class FormTagHelperTest < ActionView::TestCase
end
def test_form_tag_multipart
- actual = form_tag({}, { "multipart" => true })
+ actual = form_tag({}, "multipart" => true)
expected = whole_form("http://www.example.com", enctype: true)
assert_dom_equal expected, actual
end
def test_form_tag_with_method_patch
- actual = form_tag({}, { method: :patch })
+ actual = form_tag({}, method: :patch)
expected = whole_form("http://www.example.com", method: :patch)
assert_dom_equal expected, actual
end
def test_form_tag_with_method_put
- actual = form_tag({}, { method: :put })
+ actual = form_tag({}, method: :put)
expected = whole_form("http://www.example.com", method: :put)
assert_dom_equal expected, actual
end
def test_form_tag_with_method_delete
- actual = form_tag({}, { method: :delete })
+ actual = form_tag({}, method: :delete)
expected = whole_form("http://www.example.com", method: :delete)
assert_dom_equal expected, actual
@@ -127,14 +127,14 @@ class FormTagHelperTest < ActionView::TestCase
end
def test_form_tag_enforce_utf8_true
- actual = form_tag({}, { enforce_utf8: true })
+ actual = form_tag({}, enforce_utf8: true)
expected = whole_form("http://www.example.com", enforce_utf8: true)
assert_dom_equal expected, actual
assert actual.html_safe?
end
def test_form_tag_enforce_utf8_false
- actual = form_tag({}, { enforce_utf8: false })
+ actual = form_tag({}, enforce_utf8: false)
expected = whole_form("http://www.example.com", enforce_utf8: false)
assert_dom_equal expected, actual
assert actual.html_safe?
@@ -471,21 +471,21 @@ class FormTagHelperTest < ActionView::TestCase
def test_submit_tag_having_data_disable_with_string
assert_dom_equal(
%(<input data-disable-with="Processing..." data-confirm="Are you sure?" name='commit' type="submit" value="Save" />),
- submit_tag("Save", { "data-disable-with" => "Processing...", "data-confirm" => "Are you sure?" })
+ submit_tag("Save", "data-disable-with" => "Processing...", "data-confirm" => "Are you sure?")
)
end
def test_submit_tag_having_data_disable_with_boolean
assert_dom_equal(
%(<input data-confirm="Are you sure?" name='commit' type="submit" value="Save" />),
- submit_tag("Save", { "data-disable-with" => false, "data-confirm" => "Are you sure?" })
+ submit_tag("Save", "data-disable-with" => false, "data-confirm" => "Are you sure?")
)
end
def test_submit_tag_having_data_hash_disable_with_boolean
assert_dom_equal(
%(<input data-confirm="Are you sure?" name='commit' type="submit" value="Save" />),
- submit_tag("Save", { data: { confirm: "Are you sure?", disable_with: false } })
+ submit_tag("Save", data: { confirm: "Are you sure?", disable_with: false })
)
end
@@ -506,7 +506,7 @@ class FormTagHelperTest < ActionView::TestCase
def test_submit_tag_doesnt_have_data_disable_with_twice
assert_equal(
%(<input type="submit" name="commit" value="Save" data-confirm="Are you sure?" data-disable-with="Processing..." />),
- submit_tag("Save", { "data-disable-with" => "Processing...", "data-confirm" => "Are you sure?" })
+ submit_tag("Save", "data-disable-with" => "Processing...", "data-confirm" => "Are you sure?")
)
end
@@ -695,31 +695,31 @@ class FormTagHelperTest < ActionView::TestCase
def test_text_area_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
text_area_tag "body", "hello world", options
- assert_equal options, { option: "random_option" }
+ assert_equal options, option: "random_option"
end
def test_submit_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
submit_tag "submit value", options
- assert_equal options, { option: "random_option" }
+ assert_equal options, option: "random_option"
end
def test_button_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
button_tag "button value", options
- assert_equal options, { option: "random_option" }
+ assert_equal options, option: "random_option"
end
def test_image_submit_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
image_submit_tag "submit source", options
- assert_equal options, { option: "random_option" }
+ assert_equal options, option: "random_option"
end
def test_image_label_tag_options_symbolize_keys_side_effects
options = { option: "random_option" }
label_tag "submit source", "title", options
- assert_equal options, { option: "random_option" }
+ assert_equal options, option: "random_option"
end
def protect_against_forgery?
diff --git a/actionview/test/template/resolver_patterns_test.rb b/actionview/test/template/resolver_patterns_test.rb
index 2a4a0da197..43e3f21076 100644
--- a/actionview/test/template/resolver_patterns_test.rb
+++ b/actionview/test/template/resolver_patterns_test.rb
@@ -8,12 +8,12 @@ class ResolverPatternsTest < ActiveSupport::TestCase
end
def test_should_return_empty_list_for_unknown_path
- templates = @resolver.find_all("unknown", "custom_pattern", false, {locale: [], formats: [:html], variants: [], handlers: [:erb]})
+ templates = @resolver.find_all("unknown", "custom_pattern", false, locale: [], formats: [:html], variants: [], handlers: [:erb])
assert_equal [], templates, "expected an empty list of templates"
end
def test_should_return_template_for_declared_path
- templates = @resolver.find_all("path", "custom_pattern", false, {locale: [], formats: [:html], variants: [], handlers: [:erb]})
+ templates = @resolver.find_all("path", "custom_pattern", false, locale: [], formats: [:html], variants: [], handlers: [:erb])
assert_equal 1, templates.size, "expected one template"
assert_equal "Hello custom patterns!", templates.first.source
assert_equal "custom_pattern/path", templates.first.virtual_path
@@ -21,7 +21,7 @@ class ResolverPatternsTest < ActiveSupport::TestCase
end
def test_should_return_all_templates_when_ambiguous_pattern
- templates = @resolver.find_all("another", "custom_pattern", false, {locale: [], formats: [:html], variants: [], handlers: [:erb]})
+ templates = @resolver.find_all("another", "custom_pattern", false, locale: [], formats: [:html], variants: [], handlers: [:erb])
assert_equal 2, templates.size, "expected two templates"
assert_equal "Another template!", templates[0].source
assert_equal "custom_pattern/another", templates[0].virtual_path
@@ -30,7 +30,7 @@ class ResolverPatternsTest < ActiveSupport::TestCase
end
def test_should_return_all_variants_for_any
- templates = @resolver.find_all("hello_world", "test", false, {locale: [], formats: [:html, :text], variants: :any, handlers: [:erb]})
+ templates = @resolver.find_all("hello_world", "test", false, locale: [], formats: [:html, :text], variants: :any, handlers: [:erb])
assert_equal 3, templates.size, "expected three templates"
assert_equal "Hello phone!", templates[0].source
assert_equal "test/hello_world", templates[0].virtual_path
diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb
index 5b67b657be..4e691c9490 100644
--- a/actionview/test/template/tag_helper_test.rb
+++ b/actionview/test/template/tag_helper_test.rb
@@ -211,7 +211,7 @@ class TagHelperTest < ActionView::TestCase
end
def test_content_tag_with_empty_array_class
- str = content_tag("p", "limelight", {class: []})
+ str = content_tag("p", "limelight", class: [])
assert_equal '<p class="">limelight</p>', str
end
@@ -296,7 +296,7 @@ class TagHelperTest < ActionView::TestCase
def test_data_attributes
["data", :data].each { |data|
assert_dom_equal '<a data-a-float="3.14" data-a-big-decimal="-123.456" data-a-number="1" data-array="[1,2,3]" data-hash="{&quot;key&quot;:&quot;value&quot;}" data-string-with-quotes="double&quot;quote&quot;party&quot;" data-string="hello" data-symbol="foo" />',
- tag("a", { data => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' } })
+ tag("a", data => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' })
assert_dom_equal '<a data-a-float="3.14" data-a-big-decimal="-123.456" data-a-number="1" data-array="[1,2,3]" data-hash="{&quot;key&quot;:&quot;value&quot;}" data-string-with-quotes="double&quot;quote&quot;party&quot;" data-string="hello" data-symbol="foo" />',
tag.a(data: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' })
}
@@ -305,21 +305,21 @@ class TagHelperTest < ActionView::TestCase
def test_aria_attributes
["aria", :aria].each { |aria|
assert_dom_equal '<a aria-a-float="3.14" aria-a-big-decimal="-123.456" aria-a-number="1" aria-array="[1,2,3]" aria-hash="{&quot;key&quot;:&quot;value&quot;}" aria-string-with-quotes="double&quot;quote&quot;party&quot;" aria-string="hello" aria-symbol="foo" />',
- tag("a", { aria => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' } })
+ tag("a", aria => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' })
assert_dom_equal '<a aria-a-float="3.14" aria-a-big-decimal="-123.456" aria-a-number="1" aria-array="[1,2,3]" aria-hash="{&quot;key&quot;:&quot;value&quot;}" aria-string-with-quotes="double&quot;quote&quot;party&quot;" aria-string="hello" aria-symbol="foo" />',
tag.a(aria: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' })
}
end
def test_link_to_data_nil_equal
- div_type1 = content_tag(:div, "test", { "data-tooltip" => nil })
- div_type2 = content_tag(:div, "test", { data: {tooltip: nil} })
+ div_type1 = content_tag(:div, "test", "data-tooltip" => nil)
+ div_type2 = content_tag(:div, "test", data: {tooltip: nil})
assert_dom_equal div_type1, div_type2
end
def test_tag_builder_link_to_data_nil_equal
- div_type1 = tag.div "test", { 'data-tooltip': nil }
- div_type2 = tag.div "test", { data: {tooltip: nil} }
+ div_type1 = tag.div "test", 'data-tooltip': nil
+ div_type2 = tag.div "test", data: {tooltip: nil}
assert_dom_equal div_type1, div_type2
end
diff --git a/actionview/test/template/testing/fixture_resolver_test.rb b/actionview/test/template/testing/fixture_resolver_test.rb
index 4ae4324860..effe453fc0 100644
--- a/actionview/test/template/testing/fixture_resolver_test.rb
+++ b/actionview/test/template/testing/fixture_resolver_test.rb
@@ -3,13 +3,13 @@ require "abstract_unit"
class FixtureResolverTest < ActiveSupport::TestCase
def test_should_return_empty_list_for_unknown_path
resolver = ActionView::FixtureResolver.new()
- templates = resolver.find_all("path", "arbitrary", false, {locale: [], formats: [:html], variants: [], handlers: []})
+ templates = resolver.find_all("path", "arbitrary", false, locale: [], formats: [:html], variants: [], handlers: [])
assert_equal [], templates, "expected an empty list of templates"
end
def test_should_return_template_for_declared_path
resolver = ActionView::FixtureResolver.new("arbitrary/path.erb" => "this text")
- templates = resolver.find_all("path", "arbitrary", false, {locale: [], formats: [:html], variants: [], handlers: [:erb]})
+ templates = resolver.find_all("path", "arbitrary", false, locale: [], formats: [:html], variants: [], handlers: [:erb])
assert_equal 1, templates.size, "expected one template"
assert_equal "this text", templates.first.source
assert_equal "arbitrary/path", templates.first.virtual_path
diff --git a/actionview/test/template/testing/null_resolver_test.rb b/actionview/test/template/testing/null_resolver_test.rb
index 907431389c..5346fd3368 100644
--- a/actionview/test/template/testing/null_resolver_test.rb
+++ b/actionview/test/template/testing/null_resolver_test.rb
@@ -3,7 +3,7 @@ require "abstract_unit"
class NullResolverTest < ActiveSupport::TestCase
def test_should_return_template_for_any_path
resolver = ActionView::NullResolver.new()
- templates = resolver.find_all("path.erb", "arbitrary", false, {locale: [], formats: [:html], handlers: []})
+ templates = resolver.find_all("path.erb", "arbitrary", false, locale: [], formats: [:html], handlers: [])
assert_equal 1, templates.size, "expected one template"
assert_equal "Template generated by Null Resolver", templates.first.source
assert_equal "arbitrary/path.erb", templates.first.virtual_path.to_s
diff --git a/activejob/test/support/integration/adapters/sidekiq.rb b/activejob/test/support/integration/adapters/sidekiq.rb
index 9d0f2d0bf3..8d5a906be5 100644
--- a/activejob/test/support/integration/adapters/sidekiq.rb
+++ b/activejob/test/support/integration/adapters/sidekiq.rb
@@ -50,11 +50,10 @@ module SidekiqJobsManager
end
require "sidekiq/launcher"
- sidekiq = Sidekiq::Launcher.new({queues: ["integration_tests"],
+ sidekiq = Sidekiq::Launcher.new(queues: ["integration_tests"],
environment: "test",
concurrency: 1,
- timeout: 1,
- })
+ timeout: 1)
Sidekiq.average_scheduled_poll_interval = 0.5
Sidekiq.options[:poll_interval_average] = 1
begin
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 2468ebb6e6..0cdb0e8525 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -439,11 +439,9 @@ module ActiveModel
return message if attribute == :base
attr_name = attribute.to_s.tr(".", "_").humanize
attr_name = @base.class.human_attribute_name(attribute, default: attr_name)
- I18n.t(:"errors.format", {
- default: "%{attribute} %{message}",
+ I18n.t(:"errors.format", default: "%{attribute} %{message}",
attribute: attr_name,
- message: message
- })
+ message: message)
end
# Translates an error message in its default scope
diff --git a/activemodel/test/cases/forbidden_attributes_protection_test.rb b/activemodel/test/cases/forbidden_attributes_protection_test.rb
index af61a566cb..fdd349a0fb 100644
--- a/activemodel/test/cases/forbidden_attributes_protection_test.rb
+++ b/activemodel/test/cases/forbidden_attributes_protection_test.rb
@@ -25,14 +25,14 @@ end
class ActiveModelMassUpdateProtectionTest < ActiveSupport::TestCase
test "forbidden attributes cannot be used for mass updating" do
- params = ProtectedParams.new({ "a" => "b" })
+ params = ProtectedParams.new("a" => "b")
assert_raises(ActiveModel::ForbiddenAttributesError) do
Account.new.sanitize_for_mass_assignment(params)
end
end
test "permitted attributes can be used for mass updating" do
- params = ProtectedParams.new({ "a" => "b" }).permit!
+ params = ProtectedParams.new("a" => "b").permit!
assert_equal({ "a" => "b" }, Account.new.sanitize_for_mass_assignment(params))
end
diff --git a/activemodel/test/cases/type/integer_test.rb b/activemodel/test/cases/type/integer_test.rb
index 0fa7a12de0..e00246b602 100644
--- a/activemodel/test/cases/type/integer_test.rb
+++ b/activemodel/test/cases/type/integer_test.rb
@@ -20,7 +20,7 @@ module ActiveModel
test "random objects cast to nil" do
type = Type::Integer.new
assert_nil type.cast([1,2])
- assert_nil type.cast({1 => 2})
+ assert_nil type.cast(1 => 2)
assert_nil type.cast(1..2)
end
diff --git a/activemodel/test/cases/validations/confirmation_validation_test.rb b/activemodel/test/cases/validations/confirmation_validation_test.rb
index 9ce3955a89..b1c4d42065 100644
--- a/activemodel/test/cases/validations/confirmation_validation_test.rb
+++ b/activemodel/test/cases/validations/confirmation_validation_test.rb
@@ -56,10 +56,8 @@ class ConfirmationValidationTest < ActiveModel::TestCase
@old_load_path, @old_backend = I18n.load_path.dup, I18n.backend
I18n.load_path.clear
I18n.backend = I18n::Backend::Simple.new
- I18n.backend.store_translations("en", {
- errors: { messages: { confirmation: "doesn't match %{attribute}" } },
- activemodel: { attributes: { topic: { title: "Test Title"} } }
- })
+ I18n.backend.store_translations("en", errors: { messages: { confirmation: "doesn't match %{attribute}" } },
+ activemodel: { attributes: { topic: { title: "Test Title"} } })
Topic.validates_confirmation_of(:title)
diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb
index dbb0a95444..996075e08a 100644
--- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb
+++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb
@@ -79,17 +79,15 @@ module ActiveRecord
def raw_config
if uri.opaque
- query_hash.merge({
- "adapter" => @adapter,
- "database" => uri.opaque })
+ query_hash.merge( "adapter" => @adapter,
+ "database" => uri.opaque)
else
- query_hash.merge({
- "adapter" => @adapter,
+ query_hash.merge( "adapter" => @adapter,
"username" => uri.user,
"password" => uri.password,
"port" => uri.port,
"database" => database_from_path,
- "host" => uri.hostname })
+ "host" => uri.hostname)
end
end
diff --git a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb
index 716b7b1164..e7e37cac36 100644
--- a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb
+++ b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb
@@ -102,13 +102,13 @@ class Mysql2ActiveSchemaTest < ActiveRecord::Mysql2TestCase
def test_create_mysql_database_with_encoding
assert_equal "CREATE DATABASE `matt` DEFAULT CHARACTER SET `utf8`", create_database(:matt)
- assert_equal "CREATE DATABASE `aimonetti` DEFAULT CHARACTER SET `latin1`", create_database(:aimonetti, {charset: "latin1"})
- assert_equal "CREATE DATABASE `matt_aimonetti` DEFAULT CHARACTER SET `big5` COLLATE `big5_chinese_ci`", create_database(:matt_aimonetti, {charset: :big5, collation: :big5_chinese_ci})
+ assert_equal "CREATE DATABASE `aimonetti` DEFAULT CHARACTER SET `latin1`", create_database(:aimonetti, charset: "latin1")
+ assert_equal "CREATE DATABASE `matt_aimonetti` DEFAULT CHARACTER SET `big5` COLLATE `big5_chinese_ci`", create_database(:matt_aimonetti, charset: :big5, collation: :big5_chinese_ci)
end
def test_recreate_mysql_database_with_encoding
- create_database(:luca, {charset: "latin1"})
- assert_equal "CREATE DATABASE `luca` DEFAULT CHARACTER SET `latin1`", recreate_database(:luca, {charset: "latin1"})
+ create_database(:luca, charset: "latin1")
+ assert_equal "CREATE DATABASE `luca` DEFAULT CHARACTER SET `latin1`", recreate_database(:luca, charset: "latin1")
end
def test_add_column
@@ -142,7 +142,7 @@ class Mysql2ActiveSchemaTest < ActiveRecord::Mysql2TestCase
ActiveRecord::Base.connection.create_table :delete_me do |t|
t.timestamps null: true
end
- ActiveRecord::Base.connection.remove_timestamps :delete_me, { null: true }
+ ActiveRecord::Base.connection.remove_timestamps :delete_me, null: true
assert !column_present?("delete_me", "updated_at", "datetime")
assert !column_present?("delete_me", "created_at", "datetime")
ensure
diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb
index b6ed20abaa..475269d5cb 100644
--- a/activerecord/test/cases/adapters/mysql2/connection_test.rb
+++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb
@@ -100,21 +100,21 @@ class Mysql2ConnectionTest < ActiveRecord::Mysql2TestCase
def test_passing_arbitary_flags_to_adapter
run_without_connection do |orig_connection|
- ActiveRecord::Base.establish_connection(orig_connection.merge({flags: Mysql2::Client::COMPRESS}))
+ ActiveRecord::Base.establish_connection(orig_connection.merge(flags: Mysql2::Client::COMPRESS))
assert_equal (Mysql2::Client::COMPRESS | Mysql2::Client::FOUND_ROWS), ActiveRecord::Base.connection.raw_connection.query_options[:flags]
end
end
def test_passing_flags_by_array_to_adapter
run_without_connection do |orig_connection|
- ActiveRecord::Base.establish_connection(orig_connection.merge({flags: ["COMPRESS"] }))
+ ActiveRecord::Base.establish_connection(orig_connection.merge(flags: ["COMPRESS"]))
assert_equal ["COMPRESS", "FOUND_ROWS"], ActiveRecord::Base.connection.raw_connection.query_options[:flags]
end
end
def test_mysql_set_session_variable
run_without_connection do |orig_connection|
- ActiveRecord::Base.establish_connection(orig_connection.deep_merge({variables: {default_week_format: 3}}))
+ ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: {default_week_format: 3}))
session_mode = ActiveRecord::Base.connection.exec_query "SELECT @@SESSION.DEFAULT_WEEK_FORMAT"
assert_equal 3, session_mode.rows.first.first.to_i
end
@@ -122,7 +122,7 @@ class Mysql2ConnectionTest < ActiveRecord::Mysql2TestCase
def test_mysql_set_session_variable_to_default
run_without_connection do |orig_connection|
- ActiveRecord::Base.establish_connection(orig_connection.deep_merge({variables: {default_week_format: :default}}))
+ ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: {default_week_format: :default}))
global_mode = ActiveRecord::Base.connection.exec_query "SELECT @@GLOBAL.DEFAULT_WEEK_FORMAT"
session_mode = ActiveRecord::Base.connection.exec_query "SELECT @@SESSION.DEFAULT_WEEK_FORMAT"
assert_equal global_mode.rows, session_mode.rows
diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb
index adb5422a67..78b4bfbdaa 100644
--- a/activerecord/test/cases/adapters/postgresql/connection_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb
@@ -184,7 +184,7 @@ module ActiveRecord
def test_set_session_variable_true
run_without_connection do |orig_connection|
- ActiveRecord::Base.establish_connection(orig_connection.deep_merge({variables: {debug_print_plan: true}}))
+ ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: {debug_print_plan: true}))
set_true = ActiveRecord::Base.connection.exec_query "SHOW DEBUG_PRINT_PLAN"
assert_equal set_true.rows, [["on"]]
end
@@ -192,7 +192,7 @@ module ActiveRecord
def test_set_session_variable_false
run_without_connection do |orig_connection|
- ActiveRecord::Base.establish_connection(orig_connection.deep_merge({variables: {debug_print_plan: false}}))
+ ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: {debug_print_plan: false}))
set_false = ActiveRecord::Base.connection.exec_query "SHOW DEBUG_PRINT_PLAN"
assert_equal set_false.rows, [["off"]]
end
@@ -201,14 +201,14 @@ module ActiveRecord
def test_set_session_variable_nil
run_without_connection do |orig_connection|
# This should be a no-op that does not raise an error
- ActiveRecord::Base.establish_connection(orig_connection.deep_merge({variables: {debug_print_plan: nil}}))
+ ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: {debug_print_plan: nil}))
end
end
def test_set_session_variable_default
run_without_connection do |orig_connection|
# This should execute a query that does not raise an error
- ActiveRecord::Base.establish_connection(orig_connection.deep_merge({variables: {debug_print_plan: :default}}))
+ ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: {debug_print_plan: :default}))
end
end
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
index 04631cb5e5..6197e517d5 100644
--- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -166,19 +166,19 @@ if ActiveRecord::Base.connection.supports_extensions?
end
def test_gen1
- assert_equal(%q(" "=>""), @type.serialize({" "=>""}))
+ assert_equal(%q(" "=>""), @type.serialize(" "=>""))
end
def test_gen2
- assert_equal(%q(","=>""), @type.serialize({","=>""}))
+ assert_equal(%q(","=>""), @type.serialize(","=>""))
end
def test_gen3
- assert_equal(%q("="=>""), @type.serialize({"="=>""}))
+ assert_equal(%q("="=>""), @type.serialize("="=>""))
end
def test_gen4
- assert_equal(%q(">"=>""), @type.serialize({">"=>""}))
+ assert_equal(%q(">"=>""), @type.serialize(">"=>""))
end
def test_parse1
@@ -300,7 +300,7 @@ if ActiveRecord::Base.connection.supports_extensions?
end
def test_hstore_with_serialized_attributes
- HstoreWithSerialize.create! tags: TagCollection.new({"one" => "two"})
+ HstoreWithSerialize.create! tags: TagCollection.new("one" => "two")
record = HstoreWithSerialize.first
assert_instance_of TagCollection, record.tags
assert_equal({"one" => "two"}, record.tags.to_hash)
@@ -310,7 +310,7 @@ if ActiveRecord::Base.connection.supports_extensions?
end
def test_clone_hstore_with_serialized_attributes
- HstoreWithSerialize.create! tags: TagCollection.new({"one" => "two"})
+ HstoreWithSerialize.create! tags: TagCollection.new("one" => "two")
record = HstoreWithSerialize.first
dupe = record.dup
assert_equal({"one" => "two"}, dupe.tags.to_hash)
diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
index 67931ed228..c4f174e470 100644
--- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
@@ -283,11 +283,9 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
end
def test_habtm_collection_size_from_params
- devel = Developer.new({
- projects_attributes: {
+ devel = Developer.new( projects_attributes: {
"0" => {}
- }
- })
+ })
assert_equal 1, devel.projects.size
end
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index b513c40f48..09692fc3a0 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -682,7 +682,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
firm = Firm.all.merge!(order: "id").first
summit = firm.clients.where("name = 'Summit'").to_a
assert_equal summit, firm.clients.where("name = ?", "Summit").to_a
- assert_equal summit, firm.clients.where("name = :name", { name: "Summit" }).to_a
+ assert_equal summit, firm.clients.where("name = :name", name: "Summit").to_a
end
def test_find_first
@@ -1978,8 +1978,8 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
old = ActiveRecord::Base.store_full_sti_class
ActiveRecord::Base.store_full_sti_class = true
- firm = Namespaced::Firm.create({ name: "Some Company" })
- firm.clients.create({ name: "Some Client" })
+ firm = Namespaced::Firm.create(name: "Some Company")
+ firm.clients.create(name: "Some Client")
stats = Namespaced::Firm.all.merge!(
select: "#{Namespaced::Firm.table_name}.id, COUNT(#{Namespaced::Client.table_name}.id) AS num_clients",
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index 102884d255..8aad272bfd 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -197,7 +197,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
if current_adapter?(:Mysql2Adapter)
test "read attributes_before_type_cast on a boolean" do
- bool = Boolean.create!({ "value" => false })
+ bool = Boolean.create!("value" => false)
if RUBY_PLATFORM.include?("java")
# JRuby will return the value before typecast as string.
assert_equal "0", bool.reload.attributes_before_type_cast["value"]
diff --git a/activerecord/test/cases/attribute_set_test.rb b/activerecord/test/cases/attribute_set_test.rb
index 4dfe40bea6..059b5b2401 100644
--- a/activerecord/test/cases/attribute_set_test.rb
+++ b/activerecord/test/cases/attribute_set_test.rb
@@ -14,7 +14,7 @@ module ActiveRecord
test "building with custom types" do
builder = AttributeSet::Builder.new(foo: Type::Float.new)
- attributes = builder.build_from_database({ foo: "3.3", bar: "4.4" }, { bar: Type::Integer.new })
+ attributes = builder.build_from_database({ foo: "3.3", bar: "4.4" }, bar: Type::Integer.new)
assert_equal 3.3, attributes[:foo].value
assert_equal 4, attributes[:bar].value
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index e26b2445b8..7d619c6a91 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -279,16 +279,14 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_initialize_with_attributes
- topic = Topic.new({
- "title" => "initialized from attributes", "written_on" => "2003-12-12 23:23"
- })
+ topic = Topic.new( "title" => "initialized from attributes", "written_on" => "2003-12-12 23:23")
assert_equal("initialized from attributes", topic.title)
end
def test_initialize_with_invalid_attribute
- Topic.new({ "title" => "test",
- "last_read(1i)" => "2005", "last_read(2i)" => "2", "last_read(3i)" => "31"})
+ Topic.new("title" => "test",
+ "last_read(1i)" => "2005", "last_read(2i)" => "2", "last_read(3i)" => "31")
rescue ActiveRecord::MultiparameterAssignmentErrors => ex
assert_equal(1, ex.errors.size)
assert_equal("last_read", ex.errors[0].attribute)
@@ -710,11 +708,11 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_boolean
- b_nil = Boolean.create({ "value" => nil })
+ b_nil = Boolean.create("value" => nil)
nil_id = b_nil.id
- b_false = Boolean.create({ "value" => false })
+ b_false = Boolean.create("value" => false)
false_id = b_false.id
- b_true = Boolean.create({ "value" => true })
+ b_true = Boolean.create("value" => true)
true_id = b_true.id
b_nil = Boolean.find(nil_id)
@@ -726,7 +724,7 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_boolean_without_questionmark
- b_true = Boolean.create({ "value" => true })
+ b_true = Boolean.create("value" => true)
true_id = b_true.id
subclass = Class.new(Boolean).find true_id
@@ -736,11 +734,11 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_boolean_cast_from_string
- b_blank = Boolean.create({ "value" => "" })
+ b_blank = Boolean.create("value" => "")
blank_id = b_blank.id
- b_false = Boolean.create({ "value" => "0" })
+ b_false = Boolean.create("value" => "0")
false_id = b_false.id
- b_true = Boolean.create({ "value" => "1" })
+ b_true = Boolean.create("value" => "1")
true_id = b_true.id
b_blank = Boolean.find(blank_id)
diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb
index 7a6125d81b..4bfec47124 100644
--- a/activerecord/test/cases/connection_specification/resolver_test.rb
+++ b/activerecord/test/cases/connection_specification/resolver_test.rb
@@ -126,7 +126,7 @@ module ActiveRecord
end
def test_spec_name_with_inline_config
- spec = spec({"adapter" => "sqlite3"})
+ spec = spec("adapter" => "sqlite3")
assert_equal "primary", spec.name, "should default to primary id"
end
end
diff --git a/activerecord/test/cases/date_test.rb b/activerecord/test/cases/date_test.rb
index e8a86d0e33..2edc0415cd 100644
--- a/activerecord/test/cases/date_test.rb
+++ b/activerecord/test/cases/date_test.rb
@@ -31,7 +31,7 @@ class DateTest < ActiveRecord::TestCase
invalid_dates.each do |date_src|
assert_nothing_raised do
- topic = Topic.new({"last_read(1i)" => date_src[0].to_s, "last_read(2i)" => date_src[1].to_s, "last_read(3i)" => date_src[2].to_s})
+ topic = Topic.new("last_read(1i)" => date_src[0].to_s, "last_read(2i)" => date_src[1].to_s, "last_read(3i)" => date_src[2].to_s)
# Oracle DATE columns are datetime columns and Oracle adapter returns Time value
if current_adapter?(:OracleAdapter)
assert_equal(topic.last_read.to_date, Time.local(*date_src).to_date, "The date should be modified according to the behavior of the Time object")
diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb
index c594616aa3..8a10399ec2 100644
--- a/activerecord/test/cases/log_subscriber_test.rb
+++ b/activerecord/test/cases/log_subscriber_test.rb
@@ -103,7 +103,7 @@ class LogSubscriberTest < ActiveRecord::TestCase
logger.sql(event.new(0, sql: verb.to_s))
assert_match(/#{REGEXP_BOLD}#{REGEXP_MAGENTA} \(0.0ms\)#{REGEXP_CLEAR}/i, logger.debugs.last)
- logger.sql(event.new(0, {sql: verb.to_s, name: "SQL"}))
+ logger.sql(event.new(0, sql: verb.to_s, name: "SQL"))
assert_match(/#{REGEXP_BOLD}#{REGEXP_MAGENTA}SQL \(0.0ms\)#{REGEXP_CLEAR}/i, logger.debugs.last)
end
end
@@ -113,13 +113,13 @@ class LogSubscriberTest < ActiveRecord::TestCase
logger = TestDebugLogSubscriber.new
logger.colorize_logging = true
SQL_COLORINGS.each do |verb, _|
- logger.sql(event.new(0, {sql: verb.to_s, name: "Model Load"}))
+ logger.sql(event.new(0, sql: verb.to_s, name: "Model Load"))
assert_match(/#{REGEXP_BOLD}#{REGEXP_CYAN}Model Load \(0.0ms\)#{REGEXP_CLEAR}/i, logger.debugs.last)
- logger.sql(event.new(0, {sql: verb.to_s, name: "Model Exists"}))
+ logger.sql(event.new(0, sql: verb.to_s, name: "Model Exists"))
assert_match(/#{REGEXP_BOLD}#{REGEXP_CYAN}Model Exists \(0.0ms\)#{REGEXP_CLEAR}/i, logger.debugs.last)
- logger.sql(event.new(0, {sql: verb.to_s, name: "ANY SPECIFIC NAME"}))
+ logger.sql(event.new(0, sql: verb.to_s, name: "ANY SPECIFIC NAME"))
assert_match(/#{REGEXP_BOLD}#{REGEXP_CYAN}ANY SPECIFIC NAME \(0.0ms\)#{REGEXP_CLEAR}/i, logger.debugs.last)
end
end
diff --git a/activerecord/test/cases/migration/change_table_test.rb b/activerecord/test/cases/migration/change_table_test.rb
index 045c18eb3f..87da9c90fe 100644
--- a/activerecord/test/cases/migration/change_table_test.rb
+++ b/activerecord/test/cases/migration/change_table_test.rb
@@ -95,7 +95,7 @@ module ActiveRecord
def test_remove_timestamps_creates_updated_at_and_created_at
with_change_table do |t|
@connection.expect :remove_timestamps, nil, [:delete_me, { null: true }]
- t.remove_timestamps({ null: true })
+ t.remove_timestamps(null: true)
end
end
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index 61c754fc0e..d3d6931ea4 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -918,7 +918,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase
@migrations_path = MIGRATIONS_ROOT + "/valid"
@existing_migrations = Dir[@migrations_path + "/*.rb"]
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/to_copy"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/to_copy")
assert File.exist?(@migrations_path + "/4_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/5_people_have_descriptions.bukkits.rb")
assert_equal [@migrations_path + "/4_people_have_hobbies.bukkits.rb", @migrations_path + "/5_people_have_descriptions.bukkits.rb"], copied.map(&:filename)
@@ -927,7 +927,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase
assert_equal expected, IO.readlines(@migrations_path + "/4_people_have_hobbies.bukkits.rb")[0].chomp
files_count = Dir[@migrations_path + "/*.rb"].length
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/to_copy"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/to_copy")
assert_equal files_count, Dir[@migrations_path + "/*.rb"].length
assert copied.empty?
ensure
@@ -960,7 +960,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase
@existing_migrations = Dir[@migrations_path + "/*.rb"]
travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps")
assert File.exist?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
expected = [@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb",
@@ -968,7 +968,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase
assert_equal expected, copied.map(&:filename)
files_count = Dir[@migrations_path + "/*.rb"].length
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps")
assert_equal files_count, Dir[@migrations_path + "/*.rb"].length
assert copied.empty?
end
@@ -1005,12 +1005,12 @@ class CopyMigrationsTest < ActiveRecord::TestCase
@existing_migrations = Dir[@migrations_path + "/*.rb"]
travel_to(Time.utc(2010, 2, 20, 10, 10, 10)) do
- ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
+ ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps")
assert File.exist?(@migrations_path + "/20100301010102_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100301010103_people_have_descriptions.bukkits.rb")
files_count = Dir[@migrations_path + "/*.rb"].length
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps")
assert_equal files_count, Dir[@migrations_path + "/*.rb"].length
assert copied.empty?
end
@@ -1023,7 +1023,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase
@migrations_path = MIGRATIONS_ROOT + "/valid"
@existing_migrations = Dir[@migrations_path + "/*.rb"]
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/magic"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/magic")
assert File.exist?(@migrations_path + "/4_currencies_have_symbols.bukkits.rb")
assert_equal [@migrations_path + "/4_currencies_have_symbols.bukkits.rb"], copied.map(&:filename)
@@ -1031,7 +1031,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase
assert_equal expected, IO.readlines(@migrations_path + "/4_currencies_have_symbols.bukkits.rb")[0..1].join.chomp
files_count = Dir[@migrations_path + "/*.rb"].length
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/magic"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/magic")
assert_equal files_count, Dir[@migrations_path + "/*.rb"].length
assert copied.empty?
ensure
@@ -1080,7 +1080,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase
@existing_migrations = []
travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps")
assert File.exist?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert_equal 2, copied.length
@@ -1095,7 +1095,7 @@ class CopyMigrationsTest < ActiveRecord::TestCase
@existing_migrations = []
travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
- copied = ActiveRecord::Migration.copy(@migrations_path, {bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
+ copied = ActiveRecord::Migration.copy(@migrations_path, bukkits: MIGRATIONS_ROOT + "/to_copy_with_timestamps")
assert File.exist?(@migrations_path + "/20100726101010_people_have_hobbies.bukkits.rb")
assert File.exist?(@migrations_path + "/20100726101011_people_have_descriptions.bukkits.rb")
assert_equal 2, copied.length
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb
index d1ff270b07..d3923173a7 100644
--- a/activerecord/test/cases/nested_attributes_test.rb
+++ b/activerecord/test/cases/nested_attributes_test.rb
@@ -119,7 +119,7 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase
Pirate.accepts_nested_attributes_for :ship, reject_if: proc {|attributes| true }
pirate = Pirate.new(catchphrase: "Stop wastin' me time")
ship = pirate.create_ship(name: "s1")
- pirate.update({ship_attributes: { name: "s2", id: ship.id } })
+ pirate.update(ship_attributes: { name: "s2", id: ship.id })
assert_equal "s1", ship.reload.name
end
@@ -141,7 +141,7 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase
Man.accepts_nested_attributes_for :interests, reject_if: proc {|attributes| true }
man = Man.create(name: "John")
interest = man.interests.create(topic: "photography")
- man.update({interests_attributes: { topic: "gardening", id: interest.id } })
+ man.update(interests_attributes: { topic: "gardening", id: interest.id })
assert_equal "photography", interest.reload.topic
end
@@ -149,7 +149,7 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase
Man.accepts_nested_attributes_for :interests, reject_if: proc {|attributes| true }, allow_destroy: true
man = Man.create(name: "Jon")
interest = man.interests.create(topic: "the ladies")
- man.update({interests_attributes: { _destroy: "1", id: interest.id } })
+ man.update(interests_attributes: { _destroy: "1", id: interest.id })
assert man.reload.interests.empty?
end
@@ -170,7 +170,7 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase
Man.accepts_nested_attributes_for(:interests)
man = Man.create(name: "John")
interest = man.interests.create(topic: "photography")
- man.update({interests_attributes: {topic: "gardening", id: interest.id}})
+ man.update(interests_attributes: {topic: "gardening", id: interest.id})
assert_equal "gardening", interest.reload.topic
end
@@ -338,7 +338,7 @@ class TestNestedAttributesOnAHasOneAssociation < ActiveRecord::TestCase
end
def test_should_work_with_update_as_well
- @pirate.update({ catchphrase: "Arr", ship_attributes: { id: @ship.id, name: "Mister Pablo" } })
+ @pirate.update(catchphrase: "Arr", ship_attributes: { id: @ship.id, name: "Mister Pablo" })
@pirate.reload
assert_equal "Arr", @pirate.catchphrase
@@ -525,7 +525,7 @@ class TestNestedAttributesOnABelongsToAssociation < ActiveRecord::TestCase
end
def test_should_work_with_update_as_well
- @ship.update({ name: "Mister Pablo", pirate_attributes: { catchphrase: "Arr" } })
+ @ship.update(name: "Mister Pablo", pirate_attributes: { catchphrase: "Arr" })
@ship.reload
assert_equal "Mister Pablo", @ship.name
@@ -597,10 +597,8 @@ module NestedAttributesOnACollectionAssociationTests
end
def test_should_save_only_one_association_on_create
- pirate = Pirate.create!({
- :catchphrase => "Arr",
- association_getter => { "foo" => { name: "Grace OMalley" } }
- })
+ pirate = Pirate.create!( :catchphrase => "Arr",
+ association_getter => { "foo" => { name: "Grace OMalley" } })
assert_equal 1, pirate.reload.send(@association_name).count
end
@@ -714,7 +712,7 @@ module NestedAttributesOnACollectionAssociationTests
def test_should_not_assign_destroy_key_to_a_record
assert_nothing_raised do
- @pirate.send(association_setter, { "foo" => { "_destroy" => "0" }})
+ @pirate.send(association_setter, "foo" => { "_destroy" => "0" })
end
end
@@ -835,7 +833,7 @@ module NestedAttributesOnACollectionAssociationTests
man = Man.create(name: "John")
interest = man.interests.create(topic: "bar", zine_id: 0)
assert interest.save
- assert !man.update({interests_attributes: { id: interest.id, zine_id: "foo" }})
+ assert !man.update(interests_attributes: { id: interest.id, zine_id: "foo" })
end
end
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb
index 1dbf4fcdd6..57dc963b62 100644
--- a/activerecord/test/cases/persistence_test.rb
+++ b/activerecord/test/cases/persistence_test.rb
@@ -622,7 +622,7 @@ class PersistenceTest < ActiveRecord::TestCase
def test_update_columns
topic = Topic.find(1)
- topic.update_columns({ "approved" => true, title: "Sebastian Topic" })
+ topic.update_columns("approved" => true, title: "Sebastian Topic")
assert topic.approved?
assert_equal "Sebastian Topic", topic.title
topic.reload
@@ -643,19 +643,19 @@ class PersistenceTest < ActiveRecord::TestCase
def test_update_columns_should_raise_exception_if_new_record
topic = Topic.new
- assert_raises(ActiveRecord::ActiveRecordError) { topic.update_columns({ approved: false }) }
+ assert_raises(ActiveRecord::ActiveRecordError) { topic.update_columns(approved: false) }
end
def test_update_columns_should_not_leave_the_object_dirty
topic = Topic.find(1)
- topic.update({ "content" => "--- Have a nice day\n...\n", :author_name => "Jose" })
+ topic.update("content" => "--- Have a nice day\n...\n", :author_name => "Jose")
topic.reload
- topic.update_columns({ content: "--- You too\n...\n", "author_name" => "Sebastian" })
+ topic.update_columns(content: "--- You too\n...\n", "author_name" => "Sebastian")
assert_equal [], topic.changed
topic.reload
- topic.update_columns({ content: "--- Have a nice day\n...\n", author_name: "Jose" })
+ topic.update_columns(content: "--- Have a nice day\n...\n", author_name: "Jose")
assert_equal [], topic.changed
end
@@ -671,7 +671,7 @@ class PersistenceTest < ActiveRecord::TestCase
minivan = Minivan.find("m1")
prev_color = minivan.color
prev_name = minivan.name
- assert_raises(ActiveRecord::ActiveRecordError) { minivan.update_columns({ name: "My old minivan", color: "black" }) }
+ assert_raises(ActiveRecord::ActiveRecordError) { minivan.update_columns(name: "My old minivan", color: "black") }
assert_equal prev_color, minivan.color
assert_equal prev_name, minivan.name
@@ -967,11 +967,9 @@ class PersistenceTest < ActiveRecord::TestCase
self.table_name = :widgets
end
- instance = widget.create!({
- name: "Bob",
+ instance = widget.create!( name: "Bob",
created_at: 1.day.ago,
- updated_at: 1.day.ago
- })
+ updated_at: 1.day.ago)
created_at = instance.created_at
updated_at = instance.updated_at
diff --git a/activerecord/test/cases/pooled_connections_test.rb b/activerecord/test/cases/pooled_connections_test.rb
index 71fc0881c1..f200770562 100644
--- a/activerecord/test/cases/pooled_connections_test.rb
+++ b/activerecord/test/cases/pooled_connections_test.rb
@@ -18,7 +18,7 @@ class PooledConnectionsTest < ActiveRecord::TestCase
# Will deadlock due to lack of Monitor timeouts in 1.9
def checkout_checkin_connections(pool_size, threads)
- ActiveRecord::Base.establish_connection(@connection.merge({pool: pool_size, checkout_timeout: 0.5}))
+ ActiveRecord::Base.establish_connection(@connection.merge(pool: pool_size, checkout_timeout: 0.5))
@connection_count = 0
@timed_out = 0
threads.times do
@@ -36,7 +36,7 @@ class PooledConnectionsTest < ActiveRecord::TestCase
end
def checkout_checkin_connections_loop(pool_size, loops)
- ActiveRecord::Base.establish_connection(@connection.merge({pool: pool_size, checkout_timeout: 0.5}))
+ ActiveRecord::Base.establish_connection(@connection.merge(pool: pool_size, checkout_timeout: 0.5))
@connection_count = 0
@timed_out = 0
loops.times do
@@ -66,7 +66,7 @@ class PooledConnectionsTest < ActiveRecord::TestCase
end
def test_pooled_connection_remove
- ActiveRecord::Base.establish_connection(@connection.merge({pool: 2, checkout_timeout: 0.5}))
+ ActiveRecord::Base.establish_connection(@connection.merge(pool: 2, checkout_timeout: 0.5))
old_connection = ActiveRecord::Base.connection
extra_connection = ActiveRecord::Base.connection_pool.checkout
ActiveRecord::Base.connection_pool.remove(extra_connection)
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index d5aee29102..c9f7f2d542 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -510,7 +510,7 @@ class RelationTest < ActiveRecord::TestCase
end
def test_finding_with_hash_conditions_on_joined_table
- firms = DependentFirm.joins(:account).where({name: "RailsCore", accounts: { credit_limit: 55..60 }}).to_a
+ firms = DependentFirm.joins(:account).where(name: "RailsCore", accounts: { credit_limit: 55..60 }).to_a
assert_equal 1, firms.size
assert_equal companies(:rails_core), firms.first
end
@@ -526,7 +526,7 @@ class RelationTest < ActiveRecord::TestCase
end
def test_find_on_hash_conditions
- assert_equal Topic.all.merge!(where: {approved: false}).to_a, Topic.where({ approved: false }).to_a
+ assert_equal Topic.all.merge!(where: {approved: false}).to_a, Topic.where(approved: false).to_a
end
def test_joins_with_string_array
diff --git a/activerecord/test/cases/sanitize_test.rb b/activerecord/test/cases/sanitize_test.rb
index fc7a653557..464bb12ccb 100644
--- a/activerecord/test/cases/sanitize_test.rb
+++ b/activerecord/test/cases/sanitize_test.rb
@@ -97,9 +97,9 @@ class SanitizeTest < ActiveRecord::TestCase
end
def test_named_bind_arity
- assert_nothing_raised { bind "name = :name", { name: "37signals" } }
- assert_nothing_raised { bind "name = :name", { name: "37signals", id: 1 } }
- assert_raise(ActiveRecord::PreparedStatementInvalid) { bind "name = :name", { id: 1 } }
+ assert_nothing_raised { bind "name = :name", name: "37signals" }
+ assert_nothing_raised { bind "name = :name", name: "37signals", id: 1 }
+ assert_raise(ActiveRecord::PreparedStatementInvalid) { bind "name = :name", id: 1 }
end
class SimpleEnumerable
diff --git a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
index d44b22b285..d73d287073 100644
--- a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
+++ b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
@@ -56,28 +56,28 @@ class I18nGenerateMessageValidationTest < ActiveRecord::TestCase
test "translation for 'taken' can be overridden" do
reset_i18n_load_path do
- I18n.backend.store_translations "en", {errors: {attributes: {title: {taken: "Custom taken message" }}}}
+ I18n.backend.store_translations "en", errors: {attributes: {title: {taken: "Custom taken message" }}}
assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, value: "title")
end
end
test "translation for 'taken' can be overridden in activerecord scope" do
reset_i18n_load_path do
- I18n.backend.store_translations "en", {activerecord: {errors: {messages: {taken: "Custom taken message" }}}}
+ I18n.backend.store_translations "en", activerecord: {errors: {messages: {taken: "Custom taken message" }}}
assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, value: "title")
end
end
test "translation for 'taken' can be overridden in activerecord model scope" do
reset_i18n_load_path do
- I18n.backend.store_translations "en", {activerecord: {errors: {models: {topic: {taken: "Custom taken message" }}}}}
+ I18n.backend.store_translations "en", activerecord: {errors: {models: {topic: {taken: "Custom taken message" }}}}
assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, value: "title")
end
end
test "translation for 'taken' can be overridden in activerecord attributes scope" do
reset_i18n_load_path do
- I18n.backend.store_translations "en", {activerecord: {errors: {models: {topic: {attributes: {title: {taken: "Custom taken message" }}}}}}}
+ I18n.backend.store_translations "en", activerecord: {errors: {models: {topic: {attributes: {title: {taken: "Custom taken message" }}}}}}
assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, value: "title")
end
end
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb
index e019c9a3e1..76510cb80d 100644
--- a/activerecord/test/cases/validations_test.rb
+++ b/activerecord/test/cases/validations_test.rb
@@ -107,7 +107,7 @@ class ValidationsTest < ActiveRecord::TestCase
def test_exception_on_create_bang_with_block
assert_raise(ActiveRecord::RecordInvalid) do
- WrongReply.create!({ "title" => "OK" }) do |r|
+ WrongReply.create!("title" => "OK") do |r|
r.content = nil
end
end
diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb
index f57d8bdbdf..ea215eeb81 100644
--- a/activerecord/test/models/person.rb
+++ b/activerecord/test/models/person.rb
@@ -116,7 +116,7 @@ class NestedPerson < ActiveRecord::Base
end
def best_friend_first_name=(new_name)
- assign_attributes({ best_friend_attributes: { first_name: new_name } })
+ assign_attributes(best_friend_attributes: { first_name: new_name })
end
end
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index be1f93a0b2..422b7f0834 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -305,7 +305,7 @@ module CacheStoreBehavior
end
def test_should_read_and_write_hash
- assert @cache.write("foo", {a: "b"})
+ assert @cache.write("foo", a: "b")
assert_equal({a: "b"}, @cache.read("foo"))
end
@@ -1173,7 +1173,7 @@ class CacheStoreLoggerTest < ActiveSupport::TestCase
end
def test_log_with_string_namespace
- @cache.fetch("foo", {namespace: "string_namespace"}) { "bar" }
+ @cache.fetch("foo", namespace: "string_namespace") { "bar" }
assert_match %r{string_namespace:foo}, @buffer.string
end
@@ -1181,7 +1181,7 @@ class CacheStoreLoggerTest < ActiveSupport::TestCase
proc = Proc.new do
"proc_namespace"
end
- @cache.fetch("foo", {namespace: proc}) { "bar" }
+ @cache.fetch("foo", namespace: proc) { "bar" }
assert_match %r{proc_namespace:foo}, @buffer.string
end
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
diff --git a/activesupport/test/json/encoding_test_cases.rb b/activesupport/test/json/encoding_test_cases.rb
index ac0e2b2b05..f8c44f314f 100644
--- a/activesupport/test/json/encoding_test_cases.rb
+++ b/activesupport/test/json/encoding_test_cases.rb
@@ -70,7 +70,7 @@ module JSONTest
[ Custom.new(nil), "null" ],
[ Custom.new(:a), '"a"' ],
[ Custom.new([ :foo, "bar" ]), '["foo","bar"]' ],
- [ Custom.new({ foo: "hello", bar: "world" }), '{"bar":"world","foo":"hello"}' ],
+ [ Custom.new(foo: "hello", bar: "world"), '{"bar":"world","foo":"hello"}' ],
[ Custom.new(Hashlike.new), '{"bar":"world","foo":"hello"}' ],
[ Custom.new(Custom.new(Custom.new(:a))), '"a"' ]]
diff --git a/activesupport/test/message_encryptor_test.rb b/activesupport/test/message_encryptor_test.rb
index 3d9f90f1cc..a4976fa1ea 100644
--- a/activesupport/test/message_encryptor_test.rb
+++ b/activesupport/test/message_encryptor_test.rb
@@ -52,7 +52,7 @@ class MessageEncryptorTest < ActiveSupport::TestCase
prev = ActiveSupport.use_standard_json_time_format
ActiveSupport.use_standard_json_time_format = true
encryptor = ActiveSupport::MessageEncryptor.new(SecureRandom.random_bytes(32), SecureRandom.random_bytes(128), serializer: JSONSerializer.new)
- message = encryptor.encrypt_and_sign({ :foo => 123, "bar" => Time.utc(2010) })
+ message = encryptor.encrypt_and_sign(:foo => 123, "bar" => Time.utc(2010))
exp = { "foo" => 123, "bar" => "2010-01-01T00:00:00.000Z" }
assert_equal exp, encryptor.decrypt_and_verify(message)
ensure
diff --git a/activesupport/test/message_verifier_test.rb b/activesupport/test/message_verifier_test.rb
index 3cea0c71cc..a29727608d 100644
--- a/activesupport/test/message_verifier_test.rb
+++ b/activesupport/test/message_verifier_test.rb
@@ -50,7 +50,7 @@ class MessageVerifierTest < ActiveSupport::TestCase
prev = ActiveSupport.use_standard_json_time_format
ActiveSupport.use_standard_json_time_format = true
verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", serializer: JSONSerializer.new)
- message = verifier.generate({ :foo => 123, "bar" => Time.utc(2010) })
+ message = verifier.generate(:foo => 123, "bar" => Time.utc(2010))
exp = { "foo" => 123, "bar" => "2010-01-01T00:00:00.000Z" }
assert_equal exp, verifier.verified(message)
assert_equal exp, verifier.verify(message)
diff --git a/activesupport/test/number_helper_i18n_test.rb b/activesupport/test/number_helper_i18n_test.rb
index f9d6dcf7b2..32e6e22525 100644
--- a/activesupport/test/number_helper_i18n_test.rb
+++ b/activesupport/test/number_helper_i18n_test.rb
@@ -60,7 +60,7 @@ module ActiveSupport
def test_locale_default_format_has_precedence_over_helper_defaults
I18n.backend.store_translations "ts",
- { number: { format: { separator: ";" } } }
+ number: { format: { separator: ";" } }
assert_equal("&$ - 10;00", number_to_currency(10, locale: "ts"))
end
diff --git a/activesupport/test/number_helper_test.rb b/activesupport/test/number_helper_test.rb
index fd566f8d21..c25a3dedf7 100644
--- a/activesupport/test/number_helper_test.rb
+++ b/activesupport/test/number_helper_test.rb
@@ -46,10 +46,10 @@ module ActiveSupport
[@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper|
assert_equal("555-1234", number_helper.number_to_phone(5551234))
assert_equal("800-555-1212", number_helper.number_to_phone(8005551212))
- assert_equal("(800) 555-1212", number_helper.number_to_phone(8005551212, {area_code: true}))
- assert_equal("", number_helper.number_to_phone("", {area_code: true}))
- assert_equal("800 555 1212", number_helper.number_to_phone(8005551212, {delimiter: " "}))
- assert_equal("(800) 555-1212 x 123", number_helper.number_to_phone(8005551212, {area_code: true, extension: 123}))
+ assert_equal("(800) 555-1212", number_helper.number_to_phone(8005551212, area_code: true))
+ assert_equal("", number_helper.number_to_phone("", area_code: true))
+ assert_equal("800 555 1212", number_helper.number_to_phone(8005551212, delimiter: " "))
+ assert_equal("(800) 555-1212 x 123", number_helper.number_to_phone(8005551212, area_code: true, extension: 123))
assert_equal("800-555-1212", number_helper.number_to_phone(8005551212, extension: " "))
assert_equal("555.1212", number_helper.number_to_phone(5551212, delimiter: "."))
assert_equal("800-555-1212", number_helper.number_to_phone("8005551212"))
@@ -67,23 +67,23 @@ module ActiveSupport
assert_equal("$1,234,567,890.50", number_helper.number_to_currency(1234567890.50))
assert_equal("$1,234,567,890.51", number_helper.number_to_currency(1234567890.506))
assert_equal("-$1,234,567,890.50", number_helper.number_to_currency(-1234567890.50))
- assert_equal("-$ 1,234,567,890.50", number_helper.number_to_currency(-1234567890.50, {format: "%u %n"}))
- assert_equal("($1,234,567,890.50)", number_helper.number_to_currency(-1234567890.50, {negative_format: "(%u%n)"}))
- assert_equal("$1,234,567,892", number_helper.number_to_currency(1234567891.50, {precision: 0}))
- assert_equal("$1,234,567,890.5", number_helper.number_to_currency(1234567890.50, {precision: 1}))
- assert_equal("&pound;1234567890,50", number_helper.number_to_currency(1234567890.50, {unit: "&pound;", separator: ",", delimiter: ""}))
+ assert_equal("-$ 1,234,567,890.50", number_helper.number_to_currency(-1234567890.50, format: "%u %n"))
+ assert_equal("($1,234,567,890.50)", number_helper.number_to_currency(-1234567890.50, negative_format: "(%u%n)"))
+ assert_equal("$1,234,567,892", number_helper.number_to_currency(1234567891.50, precision: 0))
+ assert_equal("$1,234,567,890.5", number_helper.number_to_currency(1234567890.50, precision: 1))
+ assert_equal("&pound;1234567890,50", number_helper.number_to_currency(1234567890.50, unit: "&pound;", separator: ",", delimiter: ""))
assert_equal("$1,234,567,890.50", number_helper.number_to_currency("1234567890.50"))
- assert_equal("1,234,567,890.50 K&#269;", number_helper.number_to_currency("1234567890.50", {unit: "K&#269;", format: "%n %u"}))
- assert_equal("1,234,567,890.50 - K&#269;", number_helper.number_to_currency("-1234567890.50", {unit: "K&#269;", format: "%n %u", negative_format: "%n - %u"}))
- assert_equal("0.00", number_helper.number_to_currency(+0.0, {unit: "", negative_format: "(%n)"}))
+ assert_equal("1,234,567,890.50 K&#269;", number_helper.number_to_currency("1234567890.50", unit: "K&#269;", format: "%n %u"))
+ assert_equal("1,234,567,890.50 - K&#269;", number_helper.number_to_currency("-1234567890.50", unit: "K&#269;", format: "%n %u", negative_format: "%n - %u"))
+ assert_equal("0.00", number_helper.number_to_currency(+0.0, unit: "", negative_format: "(%n)"))
end
end
def test_number_to_percentage
[@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper|
assert_equal("100.000%", number_helper.number_to_percentage(100))
- assert_equal("100%", number_helper.number_to_percentage(100, {precision: 0}))
- assert_equal("302.06%", number_helper.number_to_percentage(302.0574, {precision: 2}))
+ assert_equal("100%", number_helper.number_to_percentage(100, precision: 0))
+ assert_equal("302.06%", number_helper.number_to_percentage(302.0574, precision: 2))
assert_equal("100.000%", number_helper.number_to_percentage("100"))
assert_equal("1000.000%", number_helper.number_to_percentage("1000"))
assert_equal("123.4%", number_helper.number_to_percentage(123.400, precision: 3, strip_insignificant_zeros: true))
diff --git a/activesupport/test/xml_mini_test.rb b/activesupport/test/xml_mini_test.rb
index 77b6d6df8f..2d79e71343 100644
--- a/activesupport/test/xml_mini_test.rb
+++ b/activesupport/test/xml_mini_test.rb
@@ -322,7 +322,7 @@ YAML
}
parser = @parsing["yaml"]
assert_equal(expected, parser.call(yaml))
- assert_equal({1 => "test"}, parser.call({1 => "test"}))
+ assert_equal({1 => "test"}, parser.call(1 => "test"))
assert_equal({"1 => 'test'"=>nil}, parser.call("{1 => 'test'}"))
end
diff --git a/guides/rails_guides/markdown.rb b/guides/rails_guides/markdown.rb
index 6037016f12..e6c9fea87e 100644
--- a/guides/rails_guides/markdown.rb
+++ b/guides/rails_guides/markdown.rb
@@ -54,14 +54,12 @@ module RailsGuides
end
def engine
- @engine ||= Redcarpet::Markdown.new(Renderer, {
- no_intra_emphasis: true,
+ @engine ||= Redcarpet::Markdown.new(Renderer, no_intra_emphasis: true,
fenced_code_blocks: true,
autolink: true,
strikethrough: true,
superscript: true,
- tables: true
- })
+ tables: true)
end
def extract_raw_header_and_body
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index a0af8976f1..28941fd704 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -88,16 +88,14 @@ module Rails
end
def default_options
- super.merge({
- Port: ENV.fetch("PORT", 3000).to_i,
+ super.merge( Port: ENV.fetch("PORT", 3000).to_i,
Host: ENV.fetch("HOST", "localhost").dup,
DoNotReverseLookup: true,
environment: (ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development").dup,
daemonize: false,
caching: nil,
pid: Options::DEFAULT_PID_PATH,
- restart_cmd: restart_command
- })
+ restart_cmd: restart_command)
end
private
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index 16e21aa44e..2959ae3169 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -239,7 +239,7 @@ module Rails
sentinel = /\.routes\.draw do\s*\n/m
in_root do
- inject_into_file "config/routes.rb", " #{routing_code}\n", { after: sentinel, verbose: false, force: false }
+ inject_into_file "config/routes.rb", " #{routing_code}\n", after: sentinel, verbose: false, force: false
end
end
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb
index 3b5bf7ce87..9396e2cff7 100644
--- a/railties/test/application/assets_test.rb
+++ b/railties/test/application/assets_test.rb
@@ -475,9 +475,9 @@ module ApplicationTests
class ::PostsController < ActionController::Base; end
- get "/posts", {}, {"HTTPS"=>"off"}
+ get "/posts", {}, "HTTPS"=>"off"
assert_match('src="http://example.com/assets/application.self.js', last_response.body)
- get "/posts", {}, {"HTTPS"=>"on"}
+ get "/posts", {}, "HTTPS"=>"on"
assert_match('src="https://example.com/assets/application.self.js', last_response.body)
end
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 01bdcfb9aa..ee482009d8 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -1044,7 +1044,7 @@ module ApplicationTests
app "development"
- post "/posts", {post: {"title" =>"zomg"}}
+ post "/posts", post: {"title" =>"zomg"}
assert_equal "permitted", last_response.body
end
@@ -1068,7 +1068,7 @@ module ApplicationTests
assert_equal :raise, ActionController::Parameters.action_on_unpermitted_parameters
- post "/posts", {post: {"title" =>"zomg"}}
+ post "/posts", post: {"title" =>"zomg"}
assert_match "We're sorry, but something went wrong", last_response.body
end
@@ -1108,7 +1108,7 @@ module ApplicationTests
assert_equal :raise, ActionController::Parameters.action_on_unpermitted_parameters
- post "/posts", {post: {"title" =>"zomg"}, format: "json"}
+ post "/posts", post: {"title" =>"zomg"}, format: "json"
assert_equal 200, last_response.status
end
diff --git a/railties/test/application/mailer_previews_test.rb b/railties/test/application/mailer_previews_test.rb
index 18e3a7bf0e..790aca2aa4 100644
--- a/railties/test/application/mailer_previews_test.rb
+++ b/railties/test/application/mailer_previews_test.rb
@@ -30,7 +30,7 @@ module ApplicationTests
test "/rails/mailers is accessible with correct configuration" do
add_to_config "config.action_mailer.show_previews = true"
app("production")
- get "/rails/mailers", {}, {"REMOTE_ADDR" => "4.2.42.42"}
+ get "/rails/mailers", {}, "REMOTE_ADDR" => "4.2.42.42"
assert_equal 200, last_response.status
end
diff --git a/railties/test/generators/create_migration_test.rb b/railties/test/generators/create_migration_test.rb
index 661a26afad..ddd40e4d02 100644
--- a/railties/test/generators/create_migration_test.rb
+++ b/railties/test/generators/create_migration_test.rb
@@ -51,7 +51,7 @@ class CreateMigrationTest < Rails::Generators::TestCase
end
def test_invoke_pretended
- create_migration(default_destination_path, {}, { pretend: true })
+ create_migration(default_destination_path, {}, pretend: true)
assert_no_file @migration.destination
end
@@ -92,7 +92,7 @@ class CreateMigrationTest < Rails::Generators::TestCase
def test_invoke_forced_pretended_when_exists_not_identical
migration_exists!
- create_migration(default_destination_path, { force: true }, { pretend: true }) do
+ create_migration(default_destination_path, { force: true }, pretend: true) do
"different content"
end
@@ -104,7 +104,7 @@ class CreateMigrationTest < Rails::Generators::TestCase
def test_invoke_skipped_when_exists_not_identical
migration_exists!
- create_migration(default_destination_path, {}, { skip: true }) { "different content" }
+ create_migration(default_destination_path, {}, skip: true) { "different content" }
assert_match(/skip db\/migrate\/2_create_articles.rb\n/, invoke!)
assert_no_file @migration.destination
@@ -120,7 +120,7 @@ class CreateMigrationTest < Rails::Generators::TestCase
def test_revoke_pretended
migration_exists!
- create_migration(default_destination_path, {}, { pretend: true })
+ create_migration(default_destination_path, {}, pretend: true)
assert_match(/remove db\/migrate\/1_create_articles.rb\n/, revoke!)
assert_file @existing_migration.destination
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index 45760d7129..d10671a7b4 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -300,7 +300,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase
assert_file "test/fixtures/accounts.yml", /name: MyString/, /age: 1/
assert_generated_fixture("test/fixtures/accounts.yml",
- {"one"=>{"name"=>"MyString", "age"=>1}, "two"=>{"name"=>"MyString", "age"=>1}})
+ "one"=>{"name"=>"MyString", "age"=>1}, "two"=>{"name"=>"MyString", "age"=>1})
end
def test_fixtures_use_the_references_ids
@@ -308,7 +308,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase
assert_file "test/fixtures/line_items.yml", /product: one\n cart: one/
assert_generated_fixture("test/fixtures/line_items.yml",
- {"one"=>{"product"=>"one", "cart"=>"one"}, "two"=>{"product"=>"two", "cart"=>"two"}})
+ "one"=>{"product"=>"one", "cart"=>"one"}, "two"=>{"product"=>"two", "cart"=>"two"})
end
def test_fixtures_use_the_references_ids_and_type
@@ -316,15 +316,15 @@ class ModelGeneratorTest < Rails::Generators::TestCase
assert_file "test/fixtures/line_items.yml", /product: one\n product_type: Product\n cart: one/
assert_generated_fixture("test/fixtures/line_items.yml",
- {"one"=>{"product"=>"one", "product_type"=>"Product", "cart"=>"one"},
- "two"=>{"product"=>"two", "product_type"=>"Product", "cart"=>"two"}})
+ "one"=>{"product"=>"one", "product_type"=>"Product", "cart"=>"one"},
+ "two"=>{"product"=>"two", "product_type"=>"Product", "cart"=>"two"})
end
def test_fixtures_respect_reserved_yml_keywords
run_generator ["LineItem", "no:integer", "Off:boolean", "ON:boolean"]
assert_generated_fixture("test/fixtures/line_items.yml",
- {"one"=>{"no"=>1, "Off"=>false, "ON"=>false}, "two"=>{"no"=>1, "Off"=>false, "ON"=>false}})
+ "one"=>{"no"=>1, "Off"=>false, "ON"=>false}, "two"=>{"no"=>1, "Off"=>false, "ON"=>false})
end
def test_fixture_is_skipped
@@ -343,7 +343,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase
ActiveRecord::Base.pluralize_table_names = false
run_generator
assert_generated_fixture("test/fixtures/account.yml",
- {"one"=>{"name"=>"MyString", "age"=>1}, "two"=>{"name"=>"MyString", "age"=>1}})
+ "one"=>{"name"=>"MyString", "age"=>1}, "two"=>{"name"=>"MyString", "age"=>1})
ensure
ActiveRecord::Base.pluralize_table_names = original_pluralize_table_name
end
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb
index 0ecabe95fa..534761c6a7 100644
--- a/railties/test/railties/engine_test.rb
+++ b/railties/test/railties/engine_test.rb
@@ -1288,10 +1288,10 @@ YAML
boot_rails
- get("/bukkits/bukkit", {}, {"SCRIPT_NAME" => "/foo"})
+ get("/bukkits/bukkit", {}, "SCRIPT_NAME" => "/foo")
assert_equal "/foo/bar", last_response.body
- get("/bar", {}, {"SCRIPT_NAME" => "/foo"})
+ get("/bar", {}, "SCRIPT_NAME" => "/foo")
assert_equal "/foo/bukkits/bukkit", last_response.body
end
@@ -1337,10 +1337,10 @@ YAML
boot_rails
- get("/bukkits/bukkit", {}, {"SCRIPT_NAME" => "/foo"})
+ get("/bukkits/bukkit", {}, "SCRIPT_NAME" => "/foo")
assert_equal "/foo/bar", last_response.body
- get("/bar", {}, {"SCRIPT_NAME" => "/foo"})
+ get("/bar", {}, "SCRIPT_NAME" => "/foo")
assert_equal "/foo/bukkits/bukkit", last_response.body
end