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?



552
553
554
# File 'lib/rspec/core/example.rb', line 552

def exception
  @exception
end

#finished_atTime



558
559
560
# File 'lib/rspec/core/example.rb', line 558

def finished_at
  @finished_at
end

#pending_exceptionException?



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

def pending_exception
  @pending_exception
end

#pending_fixedBoolean Also known as: pending_fixed?



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

def pending_fixed
  @pending_fixed
end

#pending_messageString?



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

def pending_message
  @pending_message
end

#run_timeFloat



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

def run_time
  @run_time
end

#started_atTime



555
556
557
# File 'lib/rspec/core/example.rb', line 555

def started_at
  @started_at
end

#statusSymbol



549
550
551
# File 'lib/rspec/core/example.rb', line 549

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



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

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

#example_skipped?Boolean



584
585
586
# File 'lib/rspec/core/example.rb', line 584

def example_skipped?
  status == :pending && !pending_exception
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.



590
591
592
593
# File 'lib/rspec/core/example.rb', line 590

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