class RSpec::Core::Example

def run(example_group_instance, reporter)

Parameters:
  • example_group_instance () -- the instance of an ExampleGroup subclass

Other tags:
    Api: - private
def run(example_group_instance, reporter)
  @example_group_instance = example_group_instance
  RSpec.current_example = self
  start(reporter)
  begin
    unless pending
      with_around_each_hooks do
        begin
          run_before_each
          @example_group_instance.instance_eval_with_args(self, &@example_block)
        rescue Pending::SkipDeclaredInExample => e
          @pending_declared_in_example = e.message
        rescue Exception => e
          set_exception(e)
        ensure
          assign_generated_description
          run_after_each
        end
      end
    end
  rescue Exception => e
    set_exception(e)
  ensure
    @example_group_instance.instance_variables.each do |ivar|
      @example_group_instance.instance_variable_set(ivar, nil)
    end
    @example_group_instance = nil
  end
  finish(reporter)
ensure
  RSpec.current_example = nil
end