diff options
author | Jeff Kreeftmeijer <jeff@kreeftmeijer.nl> | 2010-06-16 15:25:21 +0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-09-24 16:17:39 -0300 |
commit | d82d98dcd53704a2d61463768f8690eaa5acfd2b (patch) | |
tree | 0a68f5feb6e30b0fda0ac3624b00f309dd9561aa | |
parent | 127da544bbb5425d82021ee000919f15172681f3 (diff) | |
download | rails-d82d98dcd53704a2d61463768f8690eaa5acfd2b.tar.gz rails-d82d98dcd53704a2d61463768f8690eaa5acfd2b.tar.bz2 rails-d82d98dcd53704a2d61463768f8690eaa5acfd2b.zip |
got rid of the "ambiguous first argument; put parentheses or even spaces" warnings in the scaffold_generator tests [#4872 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
-rw-r--r-- | railties/test/generators/scaffold_generator_test.rb | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 446bed3269..f366600b16 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -18,44 +18,44 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase # 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 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase # 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 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase # 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 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase # 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 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase 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 |