New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RuboCop offenses #30210

Merged
merged 1 commit into from Aug 16, 2017
Jump to file or symbol
Failed to load files and symbols.
+141 −139
Diff settings

Always

Just for now

View
@@ -16,6 +16,7 @@ Style/AndOr:
# method call.
Style/BracesAroundHashParameters:
Enabled: true
EnforcedStyle: context_dependent
# Align `when` with `case`.
Layout/CaseIndentation:
@@ -154,7 +154,7 @@ class StreamFromTest < ActionCable::TestCase
subscribe_to connection, identifiers: { id: 1 }
connection.websocket.expects(:transmit)
@server.broadcast "test_room_1", { foo: "bar" }, coder: DummyEncoder
@server.broadcast "test_room_1", { foo: "bar" }, { coder: DummyEncoder }
wait_for_async
wait_for_executor connection.server.worker_pool.executor
end
@@ -30,15 +30,15 @@ def sse_with_event
def sse_with_retry
sse = SSE.new(response.stream, retry: 1000)
sse.write("{\"name\":\"John\"}")
sse.write({ name: "Ryan" }, retry: 1500)
sse.write({ name: "Ryan" }, { retry: 1500 })
ensure
sse.close
end
def sse_with_id
sse = SSE.new(response.stream)
sse.write("{\"name\":\"John\"}", id: 1)
sse.write({ name: "Ryan" }, id: 2)
sse.write({ name: "Ryan" }, { id: 2 })
ensure
sse.close
end
@@ -35,7 +35,7 @@ def redirect_with_status
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
@@ -943,8 +943,8 @@ def test_resource_has_only_collection_action
assert_resource_allowed_routes("products", {}, { id: "1" }, [], [:index, :new, :create, :show, :edit, :update, :destroy])
assert_resource_allowed_routes("products", { format: "xml" }, { id: "1" }, [], [:index, :new, :create, :show, :edit, :update, :destroy])
assert_recognizes({ controller: "products", action: "sale" }, path: "products/sale", method: :get)
assert_recognizes({ controller: "products", action: "sale", format: "xml" }, path: "products/sale.xml", method: :get)
assert_recognizes({ controller: "products", action: "sale" }, { path: "products/sale", method: :get })
assert_recognizes({ controller: "products", action: "sale", format: "xml" }, { path: "products/sale.xml", method: :get })
end
end
@@ -959,8 +959,8 @@ def test_resource_has_only_member_action
assert_resource_allowed_routes("products", {}, { id: "1" }, [], [:index, :new, :create, :show, :edit, :update, :destroy])
assert_resource_allowed_routes("products", { format: "xml" }, { id: "1" }, [], [:index, :new, :create, :show, :edit, :update, :destroy])
assert_recognizes({ controller: "products", action: "preview", id: "1" }, path: "products/1/preview", method: :get)
assert_recognizes({ controller: "products", action: "preview", id: "1", format: "xml" }, path: "products/1/preview.xml", method: :get)
assert_recognizes({ controller: "products", action: "preview", id: "1" }, { path: "products/1/preview", method: :get })
assert_recognizes({ controller: "products", action: "preview", id: "1", format: "xml" }, { path: "products/1/preview.xml", method: :get })
end
end
@@ -977,8 +977,8 @@ def test_singleton_resource_has_only_member_action
assert_singleton_resource_allowed_routes("accounts", {}, [], [:new, :create, :show, :edit, :update, :destroy])
assert_singleton_resource_allowed_routes("accounts", { format: "xml" }, [], [:new, :create, :show, :edit, :update, :destroy])
assert_recognizes({ controller: "accounts", action: "signup" }, path: "account/signup", method: :get)
assert_recognizes({ controller: "accounts", action: "signup", format: "xml" }, path: "account/signup.xml", method: :get)
assert_recognizes({ controller: "accounts", action: "signup" }, { path: "account/signup", method: :get })
assert_recognizes({ controller: "accounts", action: "signup", format: "xml" }, { path: "account/signup.xml", method: :get })
end
end
@@ -995,8 +995,8 @@ def test_nested_resource_has_only_show_and_member_action
assert_resource_allowed_routes("images", { product_id: "1" }, { id: "2" }, :show, [:index, :new, :create, :edit, :update, :destroy], "products/1/images")
assert_resource_allowed_routes("images", { product_id: "1", format: "xml" }, { id: "2" }, :show, [:index, :new, :create, :edit, :update, :destroy], "products/1/images")
assert_recognizes({ controller: "images", action: "thumbnail", product_id: "1", id: "2" }, path: "products/1/images/2/thumbnail", method: :get)
assert_recognizes({ controller: "images", action: "thumbnail", product_id: "1", id: "2", format: "jpg" }, path: "products/1/images/2/thumbnail.jpg", method: :get)
assert_recognizes({ controller: "images", action: "thumbnail", product_id: "1", id: "2" }, { path: "products/1/images/2/thumbnail", method: :get })
assert_recognizes({ controller: "images", action: "thumbnail", product_id: "1", id: "2", format: "jpg" }, { path: "products/1/images/2/thumbnail.jpg", method: :get })
end
end
@@ -1069,7 +1069,7 @@ def test_assert_routing_accepts_all_as_a_valid_method
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
@@ -1080,7 +1080,7 @@ def test_assert_routing_fails_when_not_all_http_methods_are_recognized
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
@@ -392,9 +392,9 @@ def test_should_not_impose_childless_html_tags_in_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
@@ -405,7 +405,7 @@ def test_assert_routing
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
@@ -33,11 +33,11 @@ def test_assert_generates
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
@@ -50,8 +50,8 @@ def test_assert_recognizes_with_extras
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
@@ -96,11 +96,11 @@ def test_assert_routing_raises_message
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
@@ -186,22 +186,22 @@ def test_path_not_found
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
def test_recall_should_be_used_when_scoring
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
@@ -314,7 +314,7 @@ def test_generate_uses_recall_if_needed
path, params = @formatter.generate(
nil,
{ controller: "tasks", id: 10 },
action: "index")
{ action: "index" })
assert_equal "/tasks/index/10", path
assert_equal({}, params)
end
@@ -325,7 +325,7 @@ def test_generate_with_name
path, params = @formatter.generate(
"tasks",
{ controller: "tasks" },
controller: "tasks", action: "index")
{ controller: "tasks", action: "index" })
assert_equal "/tasks", path
assert_equal({}, params)
end
@@ -191,10 +191,10 @@ class WithLayouts < PrefixedViews
private
def self.layout(formats)
find_template(name.underscore, { formats: formats }, _prefixes: ["layouts"])
find_template(name.underscore, { formats: formats }, { _prefixes: ["layouts"] })
rescue ActionView::MissingTemplate
begin
find_template("application", { formats: formats }, _prefixes: ["layouts"])
find_template("application", { formats: formats }, { _prefixes: ["layouts"] })
rescue ActionView::MissingTemplate
end
end
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.