aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/resource_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/resource_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/resource_generator_test.rb')
-rw-r--r--railties/test/generators/resource_generator_test.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb
index 71b3619351..73804dae45 100644
--- a/railties/test/generators/resource_generator_test.rb
+++ b/railties/test/generators/resource_generator_test.rb
@@ -9,8 +9,8 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
def test_help_with_inherited_options
content = run_generator ["--help"]
- assert_match /ActiveRecord options:/, content
- assert_match /TestUnit options:/, content
+ assert_match(/ActiveRecord options:/, content)
+ assert_match(/TestUnit options:/, content)
end
def test_files_from_inherited_invocation
@@ -55,7 +55,7 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
run_generator
assert_file "config/routes.rb" do |route|
- assert_match /resources :accounts$/, route
+ assert_match(/resources :accounts$/, route)
end
end
@@ -63,19 +63,19 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
content = run_generator ["accounts".freeze]
assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/
assert_file "test/unit/account_test.rb", /class AccountTest/
- assert_match /Plural version of the model detected, using singularized version. Override with --force-plural./, content
+ assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural./, content)
end
def test_plural_names_can_be_forced
content = run_generator ["accounts", "--force-plural"]
assert_file "app/models/accounts.rb", /class Accounts < ActiveRecord::Base/
assert_file "test/unit/accounts_test.rb", /class AccountsTest/
- assert_no_match /Plural version of the model detected/, content
+ assert_no_match(/Plural version of the model detected/, content)
end
def test_mass_nouns_do_not_throw_warnings
content = run_generator ["sheep".freeze]
- assert_no_match /Plural version of the model detected/, content
+ assert_no_match(/Plural version of the model detected/, content)
end
def test_route_is_removed_on_revoke
@@ -83,7 +83,7 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
run_generator ["account"], :behavior => :revoke
assert_file "config/routes.rb" do |route|
- assert_no_match /resources :accounts$/, route
+ assert_no_match(/resources :accounts$/, route)
end
end
end