Class: RSpec::Core::Example::ExecutionResult

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/core/example.rb

Overview

Represents the result of executing an example. Behaves like a hash for backwards compatibility.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exceptionException?



563
564
565
# File 'lib/rspec/core/example.rb', line 563

def exception
  @exception
end

#finished_atTime



569
570
571
# File 'lib/rspec/core/example.rb', line 569

def finished_at
  @finished_at
end

#pending_exceptionException?



582
583
584
# File 'lib/rspec/core/example.rb', line 582

def pending_exception
  @pending_exception
end

#pending_fixedBoolean



586
587
588
# File 'lib/rspec/core/example.rb', line 586

def pending_fixed
  @pending_fixed
end

#pending_messageString?



576
577
578
# File 'lib/rspec/core/example.rb', line 576

def pending_message
  @pending_message
end

#run_timeFloat



572
573
574
# File 'lib/rspec/core/example.rb', line 572

def run_time
  @run_time
end

#started_atTime



566
567
568
# File 'lib/rspec/core/example.rb', line 566

def started_at
  @started_at
end

#statusSymbol



560
561
562
# File 'lib/rspec/core/example.rb', line 560

def status
  @status
end

Instance Method Details

#ensure_timing_set(clock) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Populates finished_at and run_time if it has not yet been set



610
611
612
# File 'lib/rspec/core/example.rb', line 610

def ensure_timing_set(clock)
  calculate_run_time(clock.now) unless finished_at
end

#example_skipped?Boolean



597
598
599
# File 'lib/rspec/core/example.rb', line 597

def example_skipped?
  status == :pending && !pending_exception
end

#pending_fixed?Boolean



588
589
590
# File 'lib/rspec/core/example.rb', line 588

def pending_fixed?
  !!pending_fixed
end

#record_finished(status, finished_at) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Records the finished status of the example.



603
604
605
606
# File 'lib/rspec/core/example.rb', line 603

def record_finished(status, finished_at)
  self.status = status
  calculate_run_time(finished_at)
end