Parent

Class/Module Index [+]

Quicksearch

RSpec::Core::Example

Attributes

metadata[R]
options[R]

Public Class Methods

delegate_to_metadata(*keys) click to toggle source
# File lib/rspec/core/example.rb, line 7
def self.delegate_to_metadata(*keys)
  keys.each do |key|
    define_method(key) {@metadata[key]}
  end
end
new(example_group_class, desc, options, example_block=nil) click to toggle source
# File lib/rspec/core/example.rb, line 15
def initialize(example_group_class, desc, options, example_block=nil)
  @example_group_class, @options, @example_block = example_group_class, options, example_block
  @metadata  = @example_group_class.metadata.for_example(desc, options)
  @exception = nil
  @pending_declared_in_example = false
end

Public Instance Methods

behaviour() click to toggle source
# File lib/rspec/core/example.rb, line 26
def behaviour
  RSpec.deprecate("behaviour", "example_group")
  example_group
end
example_group() click to toggle source
# File lib/rspec/core/example.rb, line 22
def example_group
  @example_group_class
end
fail_fast(reporter, exception) click to toggle source
# File lib/rspec/core/example.rb, line 70
def fail_fast(reporter, exception)
  start(reporter)
  set_exception(exception)
  finish(reporter)
end
pending?() click to toggle source
# File lib/rspec/core/example.rb, line 31
def pending?
  !!pending
end
run(example_group_instance, reporter) click to toggle source
# File lib/rspec/core/example.rb, line 35
def run(example_group_instance, reporter)
  @example_group_instance = example_group_instance
  @example_group_instance.example = self

  start(reporter)

  begin
    unless pending
      with_pending_capture do
        with_around_hooks do
          begin
            run_before_each
            @example_group_instance.instance_eval(&@example_block)
          rescue Exception => e
            set_exception(e)
          ensure
            run_after_each
          end
        end
      end
    end
  rescue Exception => e
    set_exception(e)
  ensure
    @example_group_instance.example = nil
    assign_auto_description
  end

  finish(reporter)
end
set_exception(exception) click to toggle source
# File lib/rspec/core/example.rb, line 66
def set_exception(exception)
  @exception ||= exception
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.