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.



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

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

Instance Method Details

#<=>(other) ⇒ Object



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

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

#flaky?Boolean

Returns:

  • (Boolean)


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

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

#idObject



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

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

#runObject



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

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

#with_timestampsObject



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

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