diff options
author | Robin Dupret <robin.dupret@gmail.com> | 2014-04-27 18:19:29 +0200 |
---|---|---|
committer | Robin Dupret <robin.dupret@gmail.com> | 2014-04-27 18:25:16 +0200 |
commit | 48b3257582830206b93817e4f519e0b2fe4f9dee (patch) | |
tree | a8d975e1f804f60468039510842d1d7f60ebde4e /railties/test/generators | |
parent | 668d8420dcb77f24cea87d6568b57fa659c340b0 (diff) | |
download | rails-48b3257582830206b93817e4f519e0b2fe4f9dee.tar.gz rails-48b3257582830206b93817e4f519e0b2fe4f9dee.tar.bz2 rails-48b3257582830206b93817e4f519e0b2fe4f9dee.zip |
Swallow bundler exceptions when running tests
Let's avoid useless output when testing stuff related to Bundler.
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/shared_generator_tests.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index 8e198d5fe1..b998fef42e 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -78,9 +78,12 @@ module SharedGeneratorTests 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 @@ 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!/, 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 @@ 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!/, capture(:stdout) { generator.invoke_all }) + quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) } end def test_dev_option |