To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!
More about adding a collaboratorfailure exit code
Use the failure_exit_code
option to set a custom exit code when RSpec fails.
RSpec.configure { |c| c.failure_exit_code = 42 }
- Background
-
- Given
-
a file named "spec/spec_helper.rb" with:
RSpec.configure { |c| c.failure_exit_code = 42 }
- Scenarios
-
- A failing spec with the default exit code
- A failing spec with a custom exit code
- An error running specs spec with a custom exit code
- Success running specs spec with a custom exit code defined
- Exit with the default exit code when an `at_exit` hook is added upstream
- A failing spec with the default exit code
-
- Given
-
a file named "spec/example_spec.rb" with:
RSpec.describe "something" do it "fails" do fail end end
- When
-
I run
rspec spec/example_spec.rb
- Then
- the exit status should be 1
- A failing spec with a custom exit code
-
- Given
-
a file named "spec/example_spec.rb" with:
require 'spec_helper' RSpec.describe "something" do it "fails" do fail end end
- When
-
I run
rspec spec/example_spec.rb
- Then
- the exit status should be 42
- An error running specs spec with a custom exit code
-
- Given
-
a file named "spec/typo_spec.rb" with:
require 'spec_helper' RSpec.escribe "something" do # intentional typo it "works" do true end end
- When
-
I run
rspec spec/typo_spec.rb
- Then
- the exit status should be 42
- Success running specs spec with a custom exit code defined
-
- Given
-
a file named "spec/example_spec.rb" with:
require 'spec_helper' RSpec.describe "something" do it "works" do true end end
- When
-
I run
rspec spec/example_spec.rb
- Then
- the exit status should be 0
- Exit with the default exit code when an `at_exit` hook is added upstream
-
- Given
-
a file named "exit_at_spec.rb" with:
require 'rspec/autorun' at_exit { exit(0) } RSpec.describe "exit 0 at_exit ignored" do it "does not interfere with the default exit code" do fail end end
- When
-
I run
ruby exit_at_spec.rb
- Then
- the exit status should be 1
Last published 9 months ago by Jon Rowe.