-
-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We do want to generally rescue `Exception` and any subclasses but there are a few exceptions we should not rescue. For example, if we rescue `SystemExit`, it prevents `exit` from exiting. Fixes #2058.
- Loading branch information
1 parent
fecfcca
commit 8cada17
Showing
7 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'support/aruba_support' | ||
|
||
RSpec.describe 'When an example forks and exits it the subprocess' do | ||
include_context "aruba support" | ||
before { clean_current_dir } | ||
|
||
it 'prints the results only once' do | ||
write_file_formatted "spec/fork_spec.rb", " | ||
RSpec.describe do | ||
example { exit unless fork } | ||
end | ||
" | ||
|
||
# Must pipe output to a file to see double output bug. | ||
# If used the `aruba_support` default of capturing the output | ||
# in a StringIO, we won't see the output from the subprocess | ||
# because it can't write to a StringIO in memory in the parent process. | ||
run_command "spec/fork_spec.rb --out rspec.out" | ||
in_current_dir do | ||
finished_lines = File.read("rspec.out").lines.grep(/Finished in/) | ||
expect(finished_lines.count).to eq(1) | ||
end | ||
end | ||
end |