Method: OSpec::Example#run

Defined in:
lib/ospec/example.rb

#run(runner) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ospec/example.rb', line 23

def run runner
  begin
    runner.example_started self
    run_before_hooks
    instance_eval &@__block__
  rescue => e
    @exception = e
  ensure
    begin
      run_after_hooks
    rescue => e
      @exception = e
    end
  end

  if @exception
    runner.example_failed self
  else
    runner.example_passed self
  end
end