Repository navigation
Reading the report
For each expectation, one line: LOCATION: OUTCOME: SUMMARY. The location is the file and the line of the expectation; the outcome is Success, Failure or Error, and Pending for a pending example; the summary is expected ACTUAL to DESCRIPTION, with not for a negation, or CLASS: MESSAGE for an exception the matcher did not expect.
A success and a pending go to the standard output. A failure, when the matcher answered the wrong way, and an error, when the block raised something the matcher did not expect, go to the standard error and end the process with the status 1: the rest of the file does not run. An error is followed by the frames of its backtrace that are not in RSpec clone, Defi, Matchi or Spectus.
require "r_spec"
RSpec.describe "the report" do
it { expect(42).to be 42 }
pending "is written later"
it { expect { raise "boom" }.to raise_exception RuntimeError }
it { expect { raise "boom" }.to be_nil }
it { expect(42).to be 43 }
end$ ruby spec/report_spec.rb
spec/report_spec.rb:4: Success: expected 42 to be 42
spec/report_spec.rb:5: Pending: is written later
spec/report_spec.rb:6: Success: expected #<RuntimeError: boom> to raise exception RuntimeError
spec/report_spec.rb:7: Error: RuntimeError: boom
spec/report_spec.rb:7:in 'block (3 levels) in <main>'
spec/report_spec.rb:7:in 'block (2 levels) in <main>'
spec/report_spec.rb:7:in 'block in <main>'
spec/report_spec.rb:3:in '<main>'
$ echo $?
1A failure is the last line of its run too:
require "r_spec"
RSpec.describe "a failure" do
it { expect(42).to be 42 }
it { expect(42).to be 43 }
it { expect(:unreached).to be :unreached }
end$ ruby spec/failure_spec.rb
spec/failure_spec.rb:4: Success: expected 42 to be 42
spec/failure_spec.rb:5: Failure: expected 42 to be 43
$ echo $?
1