Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use #quietly in a few places, and s/silence/capture/ where intention …

…is capture
  • Loading branch information...
commit 2e5d31223c1ae2470d869f1333a7b829c61d40fc 1 parent ceeab61
@fxn fxn authored
View
8 railties/test/generators/app_generator_test.rb
@@ -96,7 +96,7 @@ def test_application_name_is_detected_if_it_exists_and_app_folder_renamed
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 @@ def test_rails_update_generates_correct_session_key
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 @@ def test_force_old_style_hash
protected
def action(*args, &block)
- silence(:stdout){ generator.send(*args, &block) }
+ silence(:stdout) { generator.send(*args, &block) }
end
end
@@ -284,6 +284,6 @@ def builder_class
end
def action(*args, &block)
- silence(:stdout){ generator.send(*args, &block) }
+ silence(:stdout) { generator.send(*args, &block) }
end
end
View
16 railties/test/generators/shared_generator_tests.rb
@@ -28,7 +28,7 @@ def test_skeleton_is_created
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 @@ def test_template_is_executed_when_supplied
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 @@ def test_template_is_executed_when_supplied
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 @@ def test_template_is_executed_when_supplied_an_https_path
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 @@ def test_builder_option_with_http
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
Please sign in to comment.
Something went wrong with that request. Please try again.