Class: CemAcpt::Goss::Api::ActionResponseSummary

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from DurationHandler

#duration

Constructor Details

#initialize(summary) ⇒ ActionResponseSummary

Returns a new instance of ActionResponseSummary.



120
121
122
123
124
125
126
# File 'lib/cem_acpt/goss/api/action_response.rb', line 120

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_countObject (readonly)

Returns the value of attribute failed_count.



118
119
120
# File 'lib/cem_acpt/goss/api/action_response.rb', line 118

def failed_count
  @failed_count
end

#summary_lineObject (readonly) Also known as: to_s

Returns the value of attribute summary_line.



118
119
120
# File 'lib/cem_acpt/goss/api/action_response.rb', line 118

def summary_line
  @summary_line
end

#test_countObject (readonly)

Returns the value of attribute test_count.



118
119
120
# File 'lib/cem_acpt/goss/api/action_response.rb', line 118

def test_count
  @test_count
end

Instance Method Details

#failed_percentageObject



134
135
136
# File 'lib/cem_acpt/goss/api/action_response.rb', line 134

def failed_percentage
  @failed_percentage ||= (test_count.zero? ? 0.00 : (failed_count.to_f / test_count.to_f) * 100).round(2)
end

#passed_countObject



138
139
140
# File 'lib/cem_acpt/goss/api/action_response.rb', line 138

def passed_count
  @passed_count ||= test_count - failed_count
end

#to_hObject



130
131
132
# File 'lib/cem_acpt/goss/api/action_response.rb', line 130

def to_h
  @summary
end