From b4ef958de6b16294094de28d00ba25fe2f48accc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 15 Jul 2009 20:16:37 +0200 Subject: Change false to :verbose => false as in new Thor version. --- railties/test/generators/actions_test.rb | 29 +++++++++++++++------- railties/test/generators/app_generator_test.rb | 3 ++- railties/test/generators/generators_test_helper.rb | 1 + .../test/generators/scaffold_generator_test.rb | 6 ----- 4 files changed, 23 insertions(+), 16 deletions(-) (limited to 'railties/test') diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index e8b10522b9..9a8d8075a1 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -20,6 +20,17 @@ class ActionsTest < GeneratorsTestCase assert_equal generator.instance_variable_get("@foo"), "FOO" end + def test_apply_uses_padding_in_the_applied_template + template = <<-TEMPLATE + say_status :cool, :padding + TEMPLATE + template.instance_eval "def read; self; end" + + generator.expects(:open).with("http://gist.github.com/103208.txt").returns(template) + content = action(:apply, "http://gist.github.com/103208.txt") + assert_match /cool padding/, content + end + def test_create_file_should_write_data_to_file_path action :create_file, 'lib/test_file.rb', 'heres test data' assert_file 'lib/test_file.rb', 'heres test data' @@ -31,17 +42,17 @@ class ActionsTest < GeneratorsTestCase end def test_plugin_with_git_option_should_run_plugin_install - generator.expects(:run_ruby_script).once.with("script/plugin install #{@git_plugin_uri}", false) + generator.expects(:run_ruby_script).once.with("script/plugin install #{@git_plugin_uri}", :verbose => false) action :plugin, 'restful-authentication', :git => @git_plugin_uri end def test_plugin_with_svn_option_should_run_plugin_install - generator.expects(:run_ruby_script).once.with("script/plugin install #{@svn_plugin_uri}", false) + generator.expects(:run_ruby_script).once.with("script/plugin install #{@svn_plugin_uri}", :verbose => false) action :plugin, 'restful-authentication', :svn => @svn_plugin_uri end def test_plugin_with_git_option_and_submodule_should_use_git_scm - generator.expects(:run).with("git submodule add #{@git_plugin_uri} vendor/plugins/rest_auth", false) + generator.expects(:run).with("git submodule add #{@git_plugin_uri} vendor/plugins/rest_auth", :verbose => false) action :plugin, 'rest_auth', :git => @git_plugin_uri, :submodule => true end @@ -135,32 +146,32 @@ class ActionsTest < GeneratorsTestCase end def test_generate_should_run_script_generate_with_argument_and_options - generator.expects(:run_ruby_script).once.with('script/generate model MyModel', false) + generator.expects(:run_ruby_script).once.with('script/generate model MyModel', :verbose => false) action :generate, 'model', 'MyModel' end def test_rake_should_run_rake_command_with_development_env - generator.expects(:run).once.with('rake log:clear RAILS_ENV=development', false) + generator.expects(:run).once.with('rake log:clear RAILS_ENV=development', :verbose => false) action :rake, 'log:clear' end def test_rake_with_env_option_should_run_rake_command_in_env - generator.expects(:run).once.with('rake log:clear RAILS_ENV=production', false) + generator.expects(:run).once.with('rake log:clear RAILS_ENV=production', :verbose => false) action :rake, 'log:clear', :env => 'production' end def test_rake_with_sudo_option_should_run_rake_command_with_sudo - generator.expects(:run).once.with('sudo rake log:clear RAILS_ENV=development', false) + generator.expects(:run).once.with('sudo rake log:clear RAILS_ENV=development', :verbose => false) action :rake, 'log:clear', :sudo => true end def test_capify_should_run_the_capify_command - generator.expects(:run).once.with('capify .', false) + generator.expects(:run).once.with('capify .', :verbose => false) action :capify! end def test_freeze_should_freeze_rails_edge - generator.expects(:run).once.with('rake rails:freeze:edge', false) + generator.expects(:run).once.with('rake rails:freeze:edge', :verbose => false) action :freeze! end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index c78b7d2f25..c794a2ade6 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -125,7 +125,8 @@ class AppGeneratorTest < GeneratorsTestCase end def test_rails_is_frozen - generator(:freeze => true, :database => "sqlite3").expects(:run).with("rake rails:freeze:edge", false) + generator(:freeze => true, :database => "sqlite3").expects(:run). + with("rake rails:freeze:edge", :verbose => false) silence(:stdout){ generator.invoke } assert_file 'config/environment.rb', /# RAILS_GEM_VERSION/ end diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index c9b9c33a4e..011bd518f8 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -13,6 +13,7 @@ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib" require 'generators' CURRENT_PATH = File.expand_path(Dir.pwd) +Rails::Generators.no_color! class GeneratorsTestCase < Test::Unit::TestCase include FileUtils diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 9560cf7ba7..05eadd3460 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -117,12 +117,6 @@ class ScaffoldGeneratorTest < GeneratorsTestCase assert_file "public/stylesheets/scaffold.css" end - def test_invoke_output - output = run_generator - assert_match /invoke.{4} active_record/, output - assert_match /create.{4} app\/models\/product_line\.rb/, output - end - protected def run_generator(config={}) -- cgit v1.2.3