Sha256: eb18160ff5869972934d058193e9dcdc0b7c04c956d56dd531e9f905d5480517

Contents?: true

Size: 738 Bytes

Versions: 5

Compression:

Stored size: 738 Bytes

Contents

module Fitting
  class Route
    class Responses
      def initialize(routes, coverage)
        @routes = routes
        @coverage = coverage
      end

      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fitting-2.2.0 lib/fitting/route/responses.rb
fitting-2.1.3 lib/fitting/route/responses.rb
fitting-2.1.2 lib/fitting/route/responses.rb
fitting-2.1.1 lib/fitting/route/responses.rb
fitting-2.1.0 lib/fitting/route/responses.rb