aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-05-13 02:11:47 +0200
committerXavier Noria <fxn@hashref.com>2011-05-13 02:11:47 +0200
commit2e5d31223c1ae2470d869f1333a7b829c61d40fc (patch)
tree1c2b13a491ddf9595f54d65a6ebbc5d07230856c /railties/test
parentceeab61fef15372eedf5a7fb6086efe5c83a1c09 (diff)
downloadrails-2e5d31223c1ae2470d869f1333a7b829c61d40fc.tar.gz
rails-2e5d31223c1ae2470d869f1333a7b829c61d40fc.tar.bz2
rails-2e5d31223c1ae2470d869f1333a7b829c61d40fc.zip
use #quietly in a few places, and s/silence/capture/ where intention is capture
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/app_generator_test.rb8
-rw-r--r--railties/test/generators/shared_generator_tests.rb16
2 files changed, 12 insertions, 12 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 8de829b6dd..9e1d47cd2f 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -96,7 +96,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
generator = Rails::Generators::AppGenerator.new ["rails"], { :with_dispatchers => true },
:destination_root => app_moved_root, :shell => @shell
generator.send(:app_const)
- silence(:stdout){ generator.send(:create_config_files) }
+ quietly { generator.send(:create_config_files) }
assert_file "myapp_moved/config/environment.rb", /Myapp::Application\.initialize!/
assert_file "myapp_moved/config/initializers/session_store.rb", /_myapp_session/
end
@@ -111,7 +111,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
generator = Rails::Generators::AppGenerator.new ["rails"], { :with_dispatchers => true }, :destination_root => app_root, :shell => @shell
generator.send(:app_const)
- silence(:stdout){ generator.send(:create_config_files) }
+ quietly { generator.send(:create_config_files) }
assert_file "myapp/config/initializers/session_store.rb", /_myapp_session/
end
@@ -258,7 +258,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
protected
def action(*args, &block)
- silence(:stdout){ generator.send(*args, &block) }
+ silence(:stdout) { generator.send(*args, &block) }
end
end
@@ -284,6 +284,6 @@ protected
end
def action(*args, &block)
- silence(:stdout){ generator.send(*args, &block) }
+ silence(:stdout) { generator.send(*args, &block) }
end
end
diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb
index 8fd657787e..5ce30bd281 100644
--- a/railties/test/generators/shared_generator_tests.rb
+++ b/railties/test/generators/shared_generator_tests.rb
@@ -28,7 +28,7 @@ module SharedGeneratorTests
def test_generation_runs_bundle_check
generator([destination_root]).expects(:bundle_command).with('check').once
- silence(:stdout) { generator.invoke_all }
+ quietly { generator.invoke_all }
end
def test_plugin_new_generate_pretend
@@ -88,7 +88,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!/, capture(:stdout) { generator.invoke_all })
end
def test_template_raises_an_error_with_invalid_path
@@ -103,7 +103,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!/, capture(:stdout) { generator.invoke_all })
end
def test_template_is_executed_when_supplied_an_https_path
@@ -112,25 +112,25 @@ 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!/, capture(:stdout) { generator.invoke_all })
end
def test_dev_option
generator([destination_root], :dev => true).expects(:bundle_command).with('install').once
- silence(:stdout) { generator.invoke_all }
+ quietly { generator.invoke_all }
rails_path = File.expand_path('../../..', Rails.root)
assert_file 'Gemfile', /^gem\s+["']rails["'],\s+:path\s+=>\s+["']#{Regexp.escape(rails_path)}["']$/
end
def test_edge_option
generator([destination_root], :edge => true).expects(:bundle_command).with('install').once
- silence(:stdout) { generator.invoke_all }
+ quietly { generator.invoke_all }
assert_file 'Gemfile', %r{^gem\s+["']rails["'],\s+:git\s+=>\s+["']#{Regexp.escape("git://github.com/rails/rails.git")}["']$}
end
def test_skip_gemfile
generator([destination_root], :skip_gemfile => true).expects(:bundle_command).never
- silence(:stdout) { generator.invoke_all }
+ quietly { generator.invoke_all }
assert_no_file 'Gemfile'
end
end
@@ -187,7 +187,7 @@ module SharedCustomGeneratorTests
template.instance_eval "def read; self; end" # Make the string respond to read
generator([destination_root], :builder => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)
- silence(:stdout) { generator.invoke_all }
+ quietly { generator.invoke_all }
default_files.each{ |path| assert_no_file(path) }
end