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
RSpec::Core::PendingExampleFixedError
./spec/rspec/core/resources/formatter_specs.rb:18:in `(root)'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `Formatters'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyHash.java:1063:in `fetch'
org/jruby/RubyProc.java:274:in `call'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
org/jruby/RubyIO.java:1111:in `open'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
org/jruby/RubyDir.java:335:in `chdir'
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `Formatters'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:229:in `call'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyKernel.java:2078:in `instance_exec'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:229:in `call'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:233:in `call'
16  context "with content that would pass" do
17    it "fails" do
18      pending do
19        1.should eq(1)
20      end
passing spec
passes
failing spec
fails
expected: 2
     got: 1

(compared using ==)
./spec/rspec/core/resources/formatter_specs.rb:33:in `(root)'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `Formatters'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyHash.java:1063:in `fetch'
org/jruby/RubyProc.java:274:in `call'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
org/jruby/RubyIO.java:1111:in `open'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
org/jruby/RubyDir.java:335:in `chdir'
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `Formatters'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:229:in `call'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyKernel.java:2078:in `instance_exec'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:229:in `call'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:233:in `call'
31describe "failing spec" do
32  it "fails" do
33    1.should eq(2)
34  end
35end
a failing spec with odd backtraces
fails with a backtrace that has no file
foo
(erb):1:in `result'
org/jruby/RubyKernel.java:1088:in `eval'
./spec/rspec/core/resources/formatter_specs.rb:41:in `(root)'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `Formatters'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyHash.java:1063:in `fetch'
org/jruby/RubyProc.java:274:in `call'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
org/jruby/RubyIO.java:1111:in `open'
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
org/jruby/RubyDir.java:335:in `chdir'
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `Formatters'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:229:in `call'
org/jruby/RubyKernel.java:2061:in `instance_eval'
org/jruby/RubyKernel.java:2078:in `instance_exec'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:229:in `call'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyArray.java:2336:in `collect'
org/jruby/RubyProc.java:274:in `call'
org/jruby/RubyProc.java:233:in `call'
-1# Couldn't get snippet for (erb)
fails with a backtrace containing an erb file
Exception
/foo.html.erb:1:in `
': foo (RuntimeError)
-1# Couldn't get snippet for /foo.html.erb