Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

got rid of the "ambiguous first argument; put parentheses or even spa…

…ces" warnings in the scaffold_generator tests [#4872 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
commit 109c37b73f78c5b7b45e52599ff08674470cdc56 1 parent bdba748
@jeffkreeftmeijer jeffkreeftmeijer authored spastorino committed
Showing with 32 additions and 32 deletions.
  1. +32 −32 railties/test/generators/scaffold_generator_test.rb
View
64 railties/test/generators/scaffold_generator_test.rb
@@ -18,44 +18,44 @@ def test_scaffold_on_invoke
# Route
assert_file "config/routes.rb" do |route|
- assert_match /resources :product_lines$/, route
+ assert_match(/resources :product_lines$/, route)
end
# Controller
assert_file "app/controllers/product_lines_controller.rb" do |content|
- assert_match /class ProductLinesController < ApplicationController/, content
+ assert_match(/class ProductLinesController < ApplicationController/, content)
assert_instance_method :index, content do |m|
- assert_match /@product_lines = ProductLine\.all/, m
+ assert_match(/@product_lines = ProductLine\.all/, m)
end
assert_instance_method :show, content do |m|
- assert_match /@product_line = ProductLine\.find\(params\[:id\]\)/, m
+ assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
end
assert_instance_method :new, content do |m|
- assert_match /@product_line = ProductLine\.new/, m
+ assert_match(/@product_line = ProductLine\.new/, m)
end
assert_instance_method :edit, content do |m|
- assert_match /@product_line = ProductLine\.find\(params\[:id\]\)/, m
+ assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
end
assert_instance_method :create, content do |m|
- assert_match /@product_line = ProductLine\.new\(params\[:product_line\]\)/, m
- assert_match /@product_line\.save/, m
- assert_match /@product_line\.errors/, m
+ assert_match(/@product_line = ProductLine\.new\(params\[:product_line\]\)/, m)
+ assert_match(/@product_line\.save/, m)
+ assert_match(/@product_line\.errors/, m)
end
assert_instance_method :update, content do |m|
- assert_match /@product_line = ProductLine\.find\(params\[:id\]\)/, m
- assert_match /@product_line\.update_attributes\(params\[:product_line\]\)/, m
- assert_match /@product_line\.errors/, m
+ assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
+ assert_match(/@product_line\.update_attributes\(params\[:product_line\]\)/, m)
+ assert_match(/@product_line\.errors/, m)
end
assert_instance_method :destroy, content do |m|
- assert_match /@product_line = ProductLine\.find\(params\[:id\]\)/, m
- assert_match /@product_line\.destroy/, m
+ assert_match(/@product_line = ProductLine\.find\(params\[:id\]\)/, m)
+ assert_match(/@product_line\.destroy/, m)
end
end
@@ -92,7 +92,7 @@ def test_scaffold_on_revoke
# Route
assert_file "config/routes.rb" do |route|
- assert_no_match /resources :product_lines$/, route
+ assert_no_match(/resources :product_lines$/, route)
end
# Controller
@@ -123,44 +123,44 @@ def test_scaffold_with_namespace_on_invoke
# Route
assert_file "config/routes.rb" do |route|
- assert_match /namespace :admin do resources :roles end$/, route
+ assert_match(/namespace :admin do resources :roles end$/, route)
end
# Controller
assert_file "app/controllers/admin/roles_controller.rb" do |content|
- assert_match /class Admin::RolesController < ApplicationController/, content
+ assert_match(/class Admin::RolesController < ApplicationController/, content)
assert_instance_method :index, content do |m|
- assert_match /@admin_roles = Admin::Role\.all/, m
+ assert_match(/@admin_roles = Admin::Role\.all/, m)
end
assert_instance_method :show, content do |m|
- assert_match /@admin_role = Admin::Role\.find\(params\[:id\]\)/, m
+ assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
end
assert_instance_method :new, content do |m|
- assert_match /@admin_role = Admin::Role\.new/, m
+ assert_match(/@admin_role = Admin::Role\.new/, m)
end
assert_instance_method :edit, content do |m|
- assert_match /@admin_role = Admin::Role\.find\(params\[:id\]\)/, m
+ assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
end
assert_instance_method :create, content do |m|
- assert_match /@admin_role = Admin::Role\.new\(params\[:admin_role\]\)/, m
- assert_match /@admin_role\.save/, m
- assert_match /@admin_role\.errors/, m
+ assert_match(/@admin_role = Admin::Role\.new\(params\[:admin_role\]\)/, m)
+ assert_match(/@admin_role\.save/, m)
+ assert_match(/@admin_role\.errors/, m)
end
assert_instance_method :update, content do |m|
- assert_match /@admin_role = Admin::Role\.find\(params\[:id\]\)/, m
- assert_match /@admin_role\.update_attributes\(params\[:admin_role\]\)/, m
- assert_match /@admin_role\.errors/, m
+ assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
+ assert_match(/@admin_role\.update_attributes\(params\[:admin_role\]\)/, m)
+ assert_match(/@admin_role\.errors/, m)
end
assert_instance_method :destroy, content do |m|
- assert_match /@admin_role = Admin::Role\.find\(params\[:id\]\)/, m
- assert_match /@admin_role\.destroy/, m
+ assert_match(/@admin_role = Admin::Role\.find\(params\[:id\]\)/, m)
+ assert_match(/@admin_role\.destroy/, m)
end
end
@@ -198,7 +198,7 @@ def test_scaffold_with_namespace_on_revoke
# Route
assert_file "config/routes.rb" do |route|
- assert_no_match /namespace :admin do resources :roles end$/, route
+ assert_no_match(/namespace :admin do resources :roles end$/, route)
end
# Controller
@@ -234,7 +234,7 @@ def test_scaffold_generator_on_revoke_does_not_mutilate_legacy_map_parameter
def test_scaffold_generator_outputs_error_message_on_missing_attribute_type
content = capture(:stderr) { run_generator ["post", "title:string", "body"]}
- assert_match /Missing type for attribute 'body'/, content
- assert_match /Example: 'body:string' where string is the type/, content
+ assert_match(/Missing type for attribute 'body'/, content)
+ assert_match(/Example: 'body:string' where string is the type/, content)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.