Skip to content

Commit 75f75a8

Browse files
committed
Merge pull request rails#14881 from robin850/patch-19
Swallow bundler exceptions when running tests
2 parents 4ae90a7 + 48b3257 commit 75f75a8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

railties/test/generators/shared_generator_tests.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ def test_shebang_when_is_the_same_as_default_use_env
7878
end
7979

8080
def test_template_raises_an_error_with_invalid_path
81-
content = capture(:stderr){ run_generator([destination_root, "-m", "non/existent/path"]) }
82-
assert_match(/The template \[.*\] could not be loaded/, content)
83-
assert_match(/non\/existent\/path/, content)
81+
quietly do
82+
content = capture(:stderr){ run_generator([destination_root, "-m", "non/existent/path"]) }
83+
84+
assert_match(/The template \[.*\] could not be loaded/, content)
85+
assert_match(/non\/existent\/path/, content)
86+
end
8487
end
8588

8689
def test_template_is_executed_when_supplied
@@ -89,7 +92,7 @@ def test_template_is_executed_when_supplied
8992
template.instance_eval "def read; self; end" # Make the string respond to read
9093

9194
generator([destination_root], template: path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)
92-
assert_match(/It works!/, capture(:stdout) { generator.invoke_all })
95+
quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) }
9396
end
9497

9598
def test_template_is_executed_when_supplied_an_https_path
@@ -98,7 +101,7 @@ def test_template_is_executed_when_supplied_an_https_path
98101
template.instance_eval "def read; self; end" # Make the string respond to read
99102

100103
generator([destination_root], template: path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)
101-
assert_match(/It works!/, capture(:stdout) { generator.invoke_all })
104+
quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) }
102105
end
103106

104107
def test_dev_option

0 commit comments

Comments
 (0)