Class: Cucumber::Core::Test::Result::Summary
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Result::Summary
show all
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb
Overview
An object that responds to the description protocol from the results and collects summary information.
e.g.
summary = Result::Summary.new
Result::Passed.new(0).describe_to(summary)
puts summary.total_passed
=> 1
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
339
340
341
342
343
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 339
def initialize
@totals = Hash.new { 0 }
@exceptions = []
@durations = []
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
345
346
347
348
349
350
351
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 345
def method_missing(name, *args)
if name =~ /^total_/
get_total(name)
else
increment_total(name)
end
end
|
Instance Attribute Details
#durations ⇒ Object
Returns the value of attribute durations.
337
338
339
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 337
def durations
@durations
end
|
#exceptions ⇒ Object
Returns the value of attribute exceptions.
337
338
339
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 337
def exceptions
@exceptions
end
|
Instance Method Details
#decrement_failed ⇒ Object
380
381
382
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 380
def decrement_failed
@totals[:failed] -= 1
end
|
#duration(duration) ⇒ Object
367
368
369
370
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 367
def duration(duration)
@durations << duration
self
end
|
#exception(exception) ⇒ Object
362
363
364
365
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 362
def exception(exception)
@exceptions << exception
self
end
|
#ok?(be_strict = StrictConfiguration.new) ⇒ Boolean
353
354
355
356
357
358
359
360
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 353
def ok?(be_strict = StrictConfiguration.new)
TYPES.each do |type|
if get_total(type) > 0
return false unless Result.ok?(type, be_strict)
end
end
true
end
|
#total(for_status = nil) ⇒ Object
372
373
374
375
376
377
378
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 372
def total(for_status = nil)
if for_status
@totals.fetch(for_status, 0)
else
@totals.reduce(0) { |total, status| total += status[1] }
end
end
|