RSpec Code Examples

 

 

pending spec with no implementation
is pending (PENDING: Not yet implemented)
pending command with block format
with content that would fail
is pending (PENDING: No reason given)
with content that would pass
fails n.nnnns
Expected example to fail since it is pending, but it passed.
./spec/rspec/core/resources/formatter_specs.rb:16
14
15  context "with content that would pass" do
16    it "fails" do
17      pending
18      expect(1).to eq(1)
passing spec
passesn.nnnns
failing spec
fails n.nnnns
expected: 2
     got: 1

(compared using ==)
./spec/rspec/core/resources/formatter_specs.rb:31
29RSpec.describe "failing spec" do
30  it "fails" do
31    expect(1).to eq(2)
32  end
33end
a failing spec with odd backtraces
fails with a backtrace that has no file n.nnnns
foo
./spec/rspec/core/resources/formatter_specs.rb:39
-1# Couldn't get snippet for (erb)
fails with a backtrace containing an erb file n.nnnns
Exception
-1# Couldn't get snippet for /foo.html.erb