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.



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_countObject (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_lineObject (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_countObject (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_percentageObject



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_countObject



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_hObject



132
133
134
# File 'lib/cem_acpt/goss/api/action_response.rb', line 132

def to_h
  @summary
end