Sha256: c20d2800763484949a726895e80926fbdb282ceadb5837ccca1078830f2253c4

Contents?: true

Size: 1.83 KB

Versions: 17

Compression:

Stored size: 1.83 KB

Contents

module Fitting
  class Templates
    class RealizedTemplate
      def initialize(realized_unit)
        @realized_unit = realized_unit
      end

      def to_s
        res = ''
        res += "1. Find request method and path:\n"
        @realized_unit.test_file_paths.each do |key, requests|
          all_good = requests.all?(&:documented?)
          res += "file: #{key} #{all_good ? '✔' : '✖'}\n"
        end
        res += "\n2. Find response status code:\n"
        @realized_unit.test_file_paths.each do |key, requests|
          all_good = requests.all?(&:response_documented?)
          res += "file: #{key} #{all_good ? '✔' : '✖'}\n"
        end
        res += "\n3. Find response json-schemas:\n"
        @realized_unit.test_file_paths.each do |key, requests|
          all_good = requests.all?(&:response_json_schemas?)
          res += "file: #{key} #{all_good ? '✔' : '✖'}\n"
        end
        res += "\n4. Check valid json-schemas:\n"
        @realized_unit.test_file_paths.each do |key, requests|
          all_good = requests.all?(&:valid_json_schemas?)
          res += "path: #{key} #{all_good ? '✔' : '✖'}\n"
          next if all_good
          requests.map do |request|
            next if request.valid_json_schemas?
            res += "  full path: #{request.test_path} ✖\n"
            res += "    request.method #{request.method}\n"
            res += "    request.path #{request.path}\n"
            res += "    request.response.status #{request.response.status}\n"
            res += "    request.response.body #{request.response.body}\n\n"
            request.invalid_json_schemas.map do |schema|
              res += "    json_schemas: #{schema[:json_schema]}\n"
              res += "    fully_validate: #{schema[:fully_validate]}\n\n"
            end
          end
        end
        res
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
fitting-2.17.0 lib/fitting/templates/realized_template.rb
fitting-2.16.1 lib/fitting/templates/realized_template.rb
fitting-2.16.0 lib/fitting/templates/realized_template.rb
fitting-2.15.0 lib/fitting/templates/realized_template.rb
fitting-2.14.1 lib/fitting/templates/realized_template.rb
fitting-2.14.0 lib/fitting/templates/realized_template.rb
fitting-2.13.1 lib/fitting/templates/realized_template.rb
fitting-2.13.0 lib/fitting/templates/realized_template.rb
fitting-2.12.1 lib/fitting/templates/realized_template.rb
fitting-2.12.0 lib/fitting/templates/realized_template.rb
fitting-2.11.0 lib/fitting/templates/realized_template.rb
fitting-2.10.0 lib/fitting/templates/realized_template.rb
fitting-2.9.1 lib/fitting/templates/realized_template.rb
fitting-2.9.0 lib/fitting/templates/realized_template.rb
fitting-2.8.1 lib/fitting/templates/realized_template.rb
fitting-2.8.0 lib/fitting/templates/realized_template.rb
fitting-2.7.2 lib/fitting/templates/realized_template.rb