Permalink
Browse files

Merge pull request #14881 from robin850/patch-19

Swallow bundler exceptions when running tests
  • Loading branch information...
2 parents 4ae90a7 + 48b3257 commit 75f75a8719e8dbe8ce14874ae4bd1eac0eee67ab @senny senny committed Jun 1, 2014
Showing with 8 additions and 5 deletions.
  1. +8 −5 railties/test/generators/shared_generator_tests.rb
@@ -78,9 +78,12 @@ def test_shebang_when_is_the_same_as_default_use_env
end
def test_template_raises_an_error_with_invalid_path
- content = capture(:stderr){ run_generator([destination_root, "-m", "non/existent/path"]) }
- assert_match(/The template \[.*\] could not be loaded/, content)
- assert_match(/non\/existent\/path/, content)
+ quietly do
+ content = capture(:stderr){ run_generator([destination_root, "-m", "non/existent/path"]) }
+
+ assert_match(/The template \[.*\] could not be loaded/, content)
+ assert_match(/non\/existent\/path/, content)
+ end
end
def test_template_is_executed_when_supplied
@@ -89,7 +92,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!/, capture(:stdout) { generator.invoke_all })
+ quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) }
end
def test_template_is_executed_when_supplied_an_https_path
@@ -98,7 +101,7 @@ 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!/, capture(:stdout) { generator.invoke_all })
+ quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) }
end
def test_dev_option

0 comments on commit 75f75a8

Please sign in to comment.