From 88d8ca2ef976ea802657c92a3d27e2737247ee5c Mon Sep 17 00:00:00 2001 From: Jack Dempsey Date: Sun, 13 Mar 2011 08:01:12 +0800 Subject: use parens and silence ambiguous args warnings --- railties/test/generators/shared_generator_tests.rb | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'railties/test/generators/shared_generator_tests.rb') diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index 9e6169721b..592da39ccd 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -32,7 +32,7 @@ module SharedGeneratorTests def test_invalid_database_option_raises_an_error content = capture(:stderr){ run_generator([destination_root, "-d", "unknown"]) } - assert_match /Invalid value for \-\-database option/, content + assert_match(/Invalid value for \-\-database option/, content) end def test_test_unit_is_skipped_if_required @@ -42,21 +42,21 @@ module SharedGeneratorTests def test_options_before_application_name_raises_an_error content = capture(:stderr){ run_generator(["--pretend", destination_root]) } - assert_match /Options should be given after the \w+ name. For details run: rails( plugin)? --help\n/, content + assert_match(/Options should be given after the \w+ name. For details run: rails( plugin)? --help\n/, content) end def test_name_collision_raises_an_error reserved_words = %w[application destroy plugin runner test] reserved_words.each do |reserved| content = capture(:stderr){ run_generator [File.join(destination_root, reserved)] } - assert_match /Invalid \w+ name #{reserved}. Please give a name which does not match one of the reserved rails words.\n/, content + assert_match(/Invalid \w+ name #{reserved}. Please give a name which does not match one of the reserved rails words.\n/, content) end end def test_name_raises_an_error_if_name_already_used_constant %w{ String Hash Class Module Set Symbol }.each do |ruby_class| content = capture(:stderr){ run_generator [File.join(destination_root, ruby_class)] } - assert_match /Invalid \w+ name #{ruby_class}, constant #{ruby_class} is already in use. Please choose another \w+ name.\n/, content + assert_match(/Invalid \w+ name #{ruby_class}, constant #{ruby_class} is already in use. Please choose another \w+ name.\n/, content) end end @@ -72,8 +72,8 @@ module SharedGeneratorTests def test_template_raises_an_error_with_invalid_path content = capture(:stderr){ run_generator([destination_root, "-m", "non/existant/path"]) } - assert_match /The template \[.*\] could not be loaded/, content - assert_match /non\/existant\/path/, content + assert_match(/The template \[.*\] could not be loaded/, content) + assert_match(/non\/existant\/path/, content) end def test_template_is_executed_when_supplied @@ -82,7 +82,7 @@ module SharedGeneratorTests template.instance_eval "def read; self; end" # Make the string respond to read generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) - assert_match /It works!/, silence(:stdout){ generator.invoke_all } + assert_match(/It works!/, silence(:stdout){ generator.invoke_all }) end def test_dev_option @@ -100,8 +100,8 @@ module SharedGeneratorTests def test_template_raises_an_error_with_invalid_path content = capture(:stderr){ run_generator([destination_root, "-m", "non/existant/path"]) } - assert_match /The template \[.*\] could not be loaded/, content - assert_match /non\/existant\/path/, content + assert_match(/The template \[.*\] could not be loaded/, content) + assert_match(/non\/existant\/path/, content) end def test_template_is_executed_when_supplied @@ -110,7 +110,7 @@ module SharedGeneratorTests template.instance_eval "def read; self; end" # Make the string respond to read generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) - assert_match /It works!/, silence(:stdout){ generator.invoke_all } + assert_match(/It works!/, silence(:stdout){ generator.invoke_all }) end def test_template_is_executed_when_supplied_an_https_path @@ -119,7 +119,7 @@ module SharedGeneratorTests template.instance_eval "def read; self; end" # Make the string respond to read generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) - assert_match /It works!/, silence(:stdout){ generator.invoke_all } + assert_match(/It works!/, silence(:stdout){ generator.invoke_all }) end def test_dev_option @@ -191,6 +191,6 @@ module SharedCustomGeneratorTests generator([destination_root], :builder => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) capture(:stdout) { generator.invoke_all } - default_files.each{ |path| assert_no_file path } + default_files.each{ |path| assert_no_file(path) } end end -- cgit v1.2.3