aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/scaffold_controller_generator_test.rb
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2011-05-18 20:37:57 +0900
committerAkira Matsuda <ronnie@dio.jp>2011-05-18 23:20:19 +0900
commitcce461511bde8f86aa6f82775320070ccc688273 (patch)
tree9fdee4f56bee252783bc1631ca9028d00e6d0aef /railties/test/generators/scaffold_controller_generator_test.rb
parent32b9cefb637741ac7158085790cda56360a229f2 (diff)
downloadrails-cce461511bde8f86aa6f82775320070ccc688273.tar.gz
rails-cce461511bde8f86aa6f82775320070ccc688273.tar.bz2
rails-cce461511bde8f86aa6f82775320070ccc688273.zip
be sure to parenthesize the arguments when the first one is a RegExp literal
this fixes: "warning: ambiguous first argument; put parentheses or even spaces" because: you need this to tell the parser that you're not calling :/ method (division) details (Japanese!): http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-dev/42445?42370-43277
Diffstat (limited to 'railties/test/generators/scaffold_controller_generator_test.rb')
-rw-r--r--railties/test/generators/scaffold_controller_generator_test.rb46
1 files changed, 23 insertions, 23 deletions
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb
index c7f45a807d..65b30b9fbd 100644
--- a/railties/test/generators/scaffold_controller_generator_test.rb
+++ b/railties/test/generators/scaffold_controller_generator_test.rb
@@ -14,39 +14,39 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
run_generator
assert_file "app/controllers/users_controller.rb" do |content|
- assert_match /class UsersController < ApplicationController/, content
+ assert_match(/class UsersController < ApplicationController/, content)
assert_instance_method :index, content do |m|
- assert_match /@users = User\.all/, m
+ assert_match(/@users = User\.all/, m)
end
assert_instance_method :show, content do |m|
- assert_match /@user = User\.find\(params\[:id\]\)/, m
+ assert_match(/@user = User\.find\(params\[:id\]\)/, m)
end
assert_instance_method :new, content do |m|
- assert_match /@user = User\.new/, m
+ assert_match(/@user = User\.new/, m)
end
assert_instance_method :edit, content do |m|
- assert_match /@user = User\.find\(params\[:id\]\)/, m
+ assert_match(/@user = User\.find\(params\[:id\]\)/, m)
end
assert_instance_method :create, content do |m|
- assert_match /@user = User\.new\(params\[:user\]\)/, m
- assert_match /@user\.save/, m
- assert_match /@user\.errors/, m
+ assert_match(/@user = User\.new\(params\[:user\]\)/, m)
+ assert_match(/@user\.save/, m)
+ assert_match(/@user\.errors/, m)
end
assert_instance_method :update, content do |m|
- assert_match /@user = User\.find\(params\[:id\]\)/, m
- assert_match /@user\.update_attributes\(params\[:user\]\)/, m
- assert_match /@user\.errors/, m
+ assert_match(/@user = User\.find\(params\[:id\]\)/, m)
+ assert_match(/@user\.update_attributes\(params\[:user\]\)/, m)
+ assert_match(/@user\.errors/, m)
end
assert_instance_method :destroy, content do |m|
- assert_match /@user = User\.find\(params\[:id\]\)/, m
- assert_match /@user\.destroy/, m
+ assert_match(/@user = User\.find\(params\[:id\]\)/, m)
+ assert_match(/@user\.destroy/, m)
end
end
end
@@ -73,8 +73,8 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
run_generator
assert_file "test/functional/users_controller_test.rb" do |content|
- assert_match /class UsersControllerTest < ActionController::TestCase/, content
- assert_match /test "should get index"/, content
+ assert_match(/class UsersControllerTest < ActionController::TestCase/, content)
+ assert_match(/test "should get index"/, content)
end
end
@@ -93,10 +93,10 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
run_generator ["User", "--orm=unknown"]
assert_file "app/controllers/users_controller.rb" do |content|
- assert_match /class UsersController < ApplicationController/, content
+ assert_match(/class UsersController < ApplicationController/, content)
assert_instance_method :index, content do |m|
- assert_match /@users = User\.all/, m
+ assert_match(/@users = User\.all/, m)
end
end
end
@@ -112,11 +112,11 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
run_generator ["User", "--orm=unknown"]
assert_file "app/controllers/users_controller.rb" do |content|
- assert_match /class UsersController < ApplicationController/, content
+ assert_match(/class UsersController < ApplicationController/, content)
assert_instance_method :index, content do |m|
- assert_match /@users = User\.find\(:all\)/, m
- assert_no_match /@users = User\.all/, m
+ assert_match(/@users = User\.find\(:all\)/, m)
+ assert_no_match(/@users = User\.all/, m)
end
end
ensure
@@ -127,9 +127,9 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
run_generator
assert_file "app/controllers/users_controller.rb" do |content|
if RUBY_VERSION < "1.9"
- assert_match /\{ render :action => "new" \}/, content
+ assert_match(/\{ render :action => "new" \}/, content)
else
- assert_match /\{ render action: "new" \}/, content
+ assert_match(/\{ render action: "new" \}/, content)
end
end
end
@@ -137,7 +137,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
def test_force_old_style_hash
run_generator ["User", "--old-style-hash"]
assert_file "app/controllers/users_controller.rb" do |content|
- assert_match /\{ render :action => "new" \}/, content
+ assert_match(/\{ render :action => "new" \}/, content)
end
end
end