Class: Minitest::Queue::SingleExample

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

Instance Method Summary collapse

Constructor Details

#initialize(runnable, method_name) ⇒ SingleExample

Returns a new instance of SingleExample.



154
155
156
157
# File 'lib/minitest/queue.rb', line 154

def initialize(runnable, method_name)
  @runnable = runnable
  @method_name = method_name
end

Instance Method Details

#<=>(other) ⇒ Object



163
164
165
# File 'lib/minitest/queue.rb', line 163

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

#flaky?Boolean

Returns:

  • (Boolean)


184
185
186
# File 'lib/minitest/queue.rb', line 184

def flaky?
  Minitest.queue.flaky?(self)
end

#idObject



159
160
161
# File 'lib/minitest/queue.rb', line 159

def id
  @id ||= "#{@runnable}##{@method_name}".freeze
end

#runObject



178
179
180
181
182
# File 'lib/minitest/queue.rb', line 178

def run
  with_timestamps do
    Minitest.run_one_method(@runnable, @method_name)
  end
end

#with_timestampsObject



167
168
169
170
171
172
173
174
175
176
# File 'lib/minitest/queue.rb', line 167

def with_timestamps
  start_timestamp = current_timestamp
  result = yield
  result
ensure
  if result
    result.start_timestamp = start_timestamp
    result.finish_timestamp = current_timestamp
  end
end