Module Spec::Example::ExampleMethods

  1. lib/spec/example/example_methods.rb

Public class methods

new (description, options={}, &implementation)
[show source]
# File lib/spec/example/example_methods.rb, line 111
      def initialize(description, options={}, &implementation)
        @_options = options
        @_defined_description = description
        @_implementation = implementation
        @_backtrace = caller
      end

Public instance methods

backtrace ()

Provides the backtrace up to where this example was declared.

[show source]
# File lib/spec/example/example_methods.rb, line 87
      def backtrace
        @_backtrace
      end
description ()

Declared description for this example:

describe Account do
  it "should start with a balance of 0" do
  ...

description
=> "should start with a balance of 0"
[show source]
# File lib/spec/example/example_methods.rb, line 20
      def description
        @_defined_description || ::Spec::Matchers.generated_description || "NO NAME"
      end
implementation_backtrace ()

Deprecated - use +backtrace()+

[show source]
# File lib/spec/example/example_methods.rb, line 92
      def implementation_backtrace
        Kernel.warn "ExampleMethods#implementation_backtrace is deprecated and will be removed\nfrom a future version. Please use ExampleMethods#backtrace instead.\n"
        backtrace
      end
run_after_each ()

Run all the after(:each) blocks for this example

[show source]
# File lib/spec/example/example_methods.rb, line 107
      def run_after_each
        example_group_hierarchy.run_after_each(self)
      end
run_before_each ()

Run all the before(:each) blocks for this example

[show source]
# File lib/spec/example/example_methods.rb, line 102
      def run_before_each
        example_group_hierarchy.run_before_each(self)
      end
violated (message="")
[show source]
# File lib/spec/example/example_methods.rb, line 8
      def violated(message="")
        raise Spec::Expectations::ExpectationNotMetError.new(message)
      end