Class: Fitting::Route::Responses
- Inherits:
-
Object
- Object
- Fitting::Route::Responses
- Defined in:
- lib/fitting/route/responses.rb
Instance Method Summary collapse
-
#initialize(routes, coverage) ⇒ Responses
constructor
A new instance of Responses.
- #statistics ⇒ Object
Constructor Details
#initialize(routes, coverage) ⇒ Responses
Returns a new instance of Responses.
4 5 6 7 |
# File 'lib/fitting/route/responses.rb', line 4 def initialize(routes, coverage) @routes = routes @coverage = coverage end |
Instance Method Details
#statistics ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fitting/route/responses.rb', line 9 def statistics valid_count = @coverage.coverage.size valid_percentage = @coverage.cover_ratio total_count = @routes.size invalid_count = @coverage.not_coverage.size invalid_percentage = (100.0 - @coverage.cover_ratio).round(2) [ "API responses conforming to the blueprint: #{valid_count} (#{valid_percentage}% of #{total_count}).", "API responses with validation errors or untested: #{invalid_count} (#{invalid_percentage}% of #{total_count})." ].join("\n") end |