Class: CemAcpt::Goss::Api::ActionResponseSummary
- Inherits:
-
Object
- Object
- CemAcpt::Goss::Api::ActionResponseSummary
- Includes:
- DurationHandler
- Defined in:
- lib/cem_acpt/goss/api/action_response.rb
Constant Summary
Constants included from DurationHandler
DurationHandler::DURATION_UNITS
Instance Attribute Summary collapse
-
#failed_count ⇒ Object
readonly
Returns the value of attribute failed_count.
-
#summary_line ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute summary_line.
-
#test_count ⇒ Object
readonly
Returns the value of attribute test_count.
Instance Method Summary collapse
- #failed_percentage ⇒ Object
-
#initialize(summary) ⇒ ActionResponseSummary
constructor
A new instance of ActionResponseSummary.
- #passed_count ⇒ Object
- #to_h ⇒ Object
Methods included from DurationHandler
Constructor Details
#initialize(summary) ⇒ ActionResponseSummary
Returns a new instance of ActionResponseSummary.
122 123 124 125 126 127 128 |
# File 'lib/cem_acpt/goss/api/action_response.rb', line 122 def initialize(summary) @summary = summary @duration = @summary['total-duration'] @failed_count = @summary['failed-count'] @summary_line = @summary['summary-line'] @test_count = @summary['test-count'] end |
Instance Attribute Details
#failed_count ⇒ Object (readonly)
Returns the value of attribute failed_count.
120 121 122 |
# File 'lib/cem_acpt/goss/api/action_response.rb', line 120 def failed_count @failed_count end |
#summary_line ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute summary_line.
120 121 122 |
# File 'lib/cem_acpt/goss/api/action_response.rb', line 120 def summary_line @summary_line end |
#test_count ⇒ Object (readonly)
Returns the value of attribute test_count.
120 121 122 |
# File 'lib/cem_acpt/goss/api/action_response.rb', line 120 def test_count @test_count end |
Instance Method Details
#failed_percentage ⇒ Object
136 137 138 |
# File 'lib/cem_acpt/goss/api/action_response.rb', line 136 def failed_percentage @failed_percentage ||= (test_count.zero? ? 0.00 : (failed_count.to_f / test_count.to_f) * 100).round(2) end |
#passed_count ⇒ Object
140 141 142 |
# File 'lib/cem_acpt/goss/api/action_response.rb', line 140 def passed_count @passed_count ||= test_count - failed_count end |
#to_h ⇒ Object
132 133 134 |
# File 'lib/cem_acpt/goss/api/action_response.rb', line 132 def to_h @summary end |