diff options
author | Akira Matsuda <ronnie@dio.jp> | 2011-05-18 20:37:57 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2011-05-18 23:20:19 +0900 |
commit | cce461511bde8f86aa6f82775320070ccc688273 (patch) | |
tree | 9fdee4f56bee252783bc1631ca9028d00e6d0aef /railties/test/generators_test.rb | |
parent | 32b9cefb637741ac7158085790cda56360a229f2 (diff) | |
download | rails-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_test.rb')
-rw-r--r-- | railties/test/generators_test.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 99c9d790eb..1264ac7764 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -28,7 +28,7 @@ class GeneratorsTest < Rails::Generators::TestCase def test_help_when_a_generator_with_required_arguments_is_invoked_without_arguments output = capture(:stdout){ Rails::Generators.invoke :model, [] } - assert_match /Description:/, output + assert_match(/Description:/, output) end def test_should_give_higher_preference_to_rails_generators @@ -90,8 +90,8 @@ class GeneratorsTest < Rails::Generators::TestCase def test_find_by_namespace_show_warning_if_generator_cant_be_loaded output = capture(:stderr) { Rails::Generators.find_by_namespace(:wrong) } - assert_match /\[WARNING\] Could not load generator/, output - assert_match /Rails 2\.x generator/, output + assert_match(/\[WARNING\] Could not load generator/, output) + assert_match(/Rails 2\.x generator/, output) end def test_invoke_with_nested_namespaces @@ -104,38 +104,38 @@ class GeneratorsTest < Rails::Generators::TestCase def test_rails_generators_help_with_builtin_information output = capture(:stdout){ Rails::Generators.help } - assert_match /Rails:/, output - assert_match /^ model$/, output - assert_match /^ scaffold_controller$/, output - assert_no_match /^ app$/, output + assert_match(/Rails:/, output) + assert_match(/^ model$/, output) + assert_match(/^ scaffold_controller$/, output) + assert_no_match(/^ app$/, output) end def test_rails_generators_help_does_not_include_app_nor_plugin_new output = capture(:stdout){ Rails::Generators.help } - assert_no_match /app/, output - assert_no_match /plugin_new/, output + assert_no_match(/app/, output) + assert_no_match(/plugin_new/, output) end def test_rails_generators_with_others_information output = capture(:stdout){ Rails::Generators.help } - assert_match /Fixjour:/, output - assert_match /^ fixjour$/, output + assert_match(/Fixjour:/, output) + assert_match(/^ fixjour$/, output) end def test_rails_generators_does_not_show_active_record_hooks output = capture(:stdout){ Rails::Generators.help } - assert_match /ActiveRecord:/, output - assert_match /^ active_record:fixjour$/, output + assert_match(/ActiveRecord:/, output) + assert_match(/^ active_record:fixjour$/, output) end def test_default_banner_should_show_generator_namespace klass = Rails::Generators.find_by_namespace(:foobar) - assert_match /^rails generate foobar:foobar/, klass.banner + assert_match(/^rails generate foobar:foobar/, klass.banner) end def test_default_banner_should_not_show_rails_generator_namespace klass = Rails::Generators.find_by_namespace(:model) - assert_match /^rails generate model/, klass.banner + assert_match(/^rails generate model/, klass.banner) end def test_no_color_sets_proper_shell |