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:2021:in `instance_eval'
org/jruby/RubyArray.java:2336:in `collect'
29            teardown_mocks_for_rspec
30          end
31          raise RSpec::Core::PendingExampleFixedError.new if result
32        end
33        raise PendingDeclaredInExample.new(message)
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:2021:in `instance_eval'
org/jruby/RubyArray.java:2336:in `collect'
27        end
28
29        raise(RSpec::Expectations::ExpectationNotMetError.new(message))
30      end
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:2021:in `instance_eval'
org/jruby/RubyArray.java:2336:in `collect'
-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