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?



469
470
471
# File 'lib/rspec/core/example.rb', line 469

def exception
  @exception
end

#finished_atTime



475
476
477
# File 'lib/rspec/core/example.rb', line 475

def finished_at
  @finished_at
end

#pending_exceptionException?



488
489
490
# File 'lib/rspec/core/example.rb', line 488

def pending_exception
  @pending_exception
end

#pending_fixedBoolean Also known as: pending_fixed?



492
493
494
# File 'lib/rspec/core/example.rb', line 492

def pending_fixed
  @pending_fixed
end

#pending_messageString?



482
483
484
# File 'lib/rspec/core/example.rb', line 482

def pending_message
  @pending_message
end

#run_timeFloat



478
479
480
# File 'lib/rspec/core/example.rb', line 478

def run_time
  @run_time
end

#started_atTime



472
473
474
# File 'lib/rspec/core/example.rb', line 472

def started_at
  @started_at
end

#statusSymbol



466
467
468
# File 'lib/rspec/core/example.rb', line 466

def status
  @status
end

Instance Method Details

#example_skipped?Boolean



501
502
503
# File 'lib/rspec/core/example.rb', line 501

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.



507
508
509
510
511
# File 'lib/rspec/core/example.rb', line 507

def record_finished(status, finished_at)
  self.status      = status
  self.finished_at = finished_at
  self.run_time    = (finished_at - started_at).to_f
end