Class: Spec::Example::ExampleGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/rspec/rspec_extensions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#execution_errorObject (readonly)

Returns the value of attribute execution_error.



19
20
21
# File 'lib/selenium/rspec/rspec_extensions.rb', line 19

def execution_error
  @execution_error
end

Instance Method Details

#execute(options, instance_variables) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/selenium/rspec/rspec_extensions.rb', line 21

def execute(options, instance_variables)
  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