Class: Minitest::Queue::SingleExample
- Inherits:
-
Object
- Object
- Minitest::Queue::SingleExample
- Defined in:
- lib/minitest/queue.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#runnable ⇒ Object
readonly
Returns the value of attribute runnable.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #flaky? ⇒ Boolean
- #id ⇒ Object
-
#initialize(runnable, method_name) ⇒ SingleExample
constructor
A new instance of SingleExample.
- #queue_entry ⇒ Object
- #run ⇒ Object
- #source_location ⇒ Object
- #with_timestamps ⇒ Object
Constructor Details
#initialize(runnable, method_name) ⇒ SingleExample
Returns a new instance of SingleExample.
320 321 322 323 |
# File 'lib/minitest/queue.rb', line 320 def initialize(runnable, method_name) @runnable = runnable @method_name = method_name end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
318 319 320 |
# File 'lib/minitest/queue.rb', line 318 def method_name @method_name end |
#runnable ⇒ Object (readonly)
Returns the value of attribute runnable.
318 319 320 |
# File 'lib/minitest/queue.rb', line 318 def runnable @runnable end |
Instance Method Details
#<=>(other) ⇒ Object
333 334 335 |
# File 'lib/minitest/queue.rb', line 333 def <=>(other) id <=> other.id end |
#flaky? ⇒ Boolean
354 355 356 |
# File 'lib/minitest/queue.rb', line 354 def flaky? Minitest.queue.flaky?(self) end |
#id ⇒ Object
325 326 327 |
# File 'lib/minitest/queue.rb', line 325 def id @id ||= "#{@runnable}##{@method_name}".freeze end |
#queue_entry ⇒ Object
329 330 331 |
# File 'lib/minitest/queue.rb', line 329 def queue_entry id end |
#run ⇒ Object
348 349 350 351 352 |
# File 'lib/minitest/queue.rb', line 348 def run do Minitest.run_one_method(@runnable, @method_name) end end |
#source_location ⇒ Object
358 359 360 361 362 |
# File 'lib/minitest/queue.rb', line 358 def source_location @runnable.instance_method(@method_name).source_location rescue NameError, NoMethodError nil end |
#with_timestamps ⇒ Object
337 338 339 340 341 342 343 344 345 346 |
# File 'lib/minitest/queue.rb', line 337 def = result = yield result ensure if result result. = result. = end end |