Class: RSpec::Queue::SingleExample

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(example_group, example) ⇒ SingleExample

Returns a new instance of SingleExample.



255
256
257
258
# File 'lib/rspec/queue.rb', line 255

def initialize(example_group, example)
  @example_group = example_group
  @example = example
end

Instance Attribute Details

#exampleObject (readonly)

Returns the value of attribute example.



253
254
255
# File 'lib/rspec/queue.rb', line 253

def example
  @example
end

#example_groupObject (readonly)

Returns the value of attribute example_group.



253
254
255
# File 'lib/rspec/queue.rb', line 253

def example_group
  @example_group
end

Instance Method Details

#<=>(other) ⇒ Object



271
272
273
# File 'lib/rspec/queue.rb', line 271

def <=>(other)
  id <=> other.id
end

#idObject



260
261
262
# File 'lib/rspec/queue.rb', line 260

def id
  example.id
end

#queue_entryObject



264
265
266
267
268
269
# File 'lib/rspec/queue.rb', line 264

def queue_entry
  @queue_entry ||= begin
    file_path = example.[:absolute_file_path] || example.file_path
    CI::Queue::QueueEntry.format(id, file_path)
  end
end

#run(reporter) ⇒ Object



275
276
277
278
279
280
# File 'lib/rspec/queue.rb', line 275

def run(reporter)
  instance = example_group.new(example.inspect_output)
  example_group.set_ivars(instance, example_group.before_context_ivars)
  result = example.run(instance, reporter)
  result.nil? ? true : result
end