Method: Spec::Example::ExampleMethods#execute

Defined in:
lib/spec/example/example_methods.rb

#execute(options, instance_variables) ⇒ Object

:nodoc:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/spec/example/example_methods.rb', line 41

def execute(options, instance_variables) # :nodoc:
  options.reporter.example_started(self)
  set_instance_variables_from_hash(instance_variables)
  
  execution_error = nil
  Timeout.timeout(options.timeout) do
    begin
      before_each_example
      eval_block
    rescue Exception => e
      execution_error ||= e
    end
    begin
      after_each_example
    rescue Exception => e
      execution_error ||= e
    end
  end

  options.reporter.example_finished(self, execution_error)
  success = execution_error.nil? || ExamplePendingError === execution_error
end