fitting 2.17.0 → 2.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +34 -3
- data/CHANGELOG.md +20 -0
- data/fitting.gemspec +9 -7
- data/lib/fitting/configuration/yaml.rb +13 -13
- data/lib/fitting/configuration.rb +3 -39
- data/lib/fitting/cover/json_schema.rb +3 -2
- data/lib/fitting/cover/json_schema_enum.rb +1 -1
- data/lib/fitting/cover/json_schema_one_of.rb +1 -1
- data/lib/fitting/cover/response.rb +1 -5
- data/lib/fitting/documentation.rb +0 -2
- data/lib/fitting/matchers/response_matcher.rb +2 -9
- data/lib/fitting/records/documented/request.rb +1 -0
- data/lib/fitting/records/realized_unit.rb +13 -15
- data/lib/fitting/records/spherical/request.rb +1 -1
- data/lib/fitting/records/spherical/requests.rb +2 -1
- data/lib/fitting/records/spherical/response.rb +2 -2
- data/lib/fitting/records/test_unit/request.rb +4 -0
- data/lib/fitting/records/tested/request.rb +4 -4
- data/lib/fitting/records/unit/combination.rb +5 -6
- data/lib/fitting/records/unit/json_schema.rb +38 -33
- data/lib/fitting/records/unit/request.rb +1 -0
- data/lib/fitting/records/unit/response.rb +1 -0
- data/lib/fitting/report/action.rb +6 -9
- data/lib/fitting/report/actions.rb +7 -5
- data/lib/fitting/report/combination.rb +1 -15
- data/lib/fitting/report/combinations.rb +4 -5
- data/lib/fitting/report/console.rb +33 -12
- data/lib/fitting/report/prefix.rb +42 -51
- data/lib/fitting/report/prefixes.rb +3 -3
- data/lib/fitting/report/response.rb +17 -18
- data/lib/fitting/report/responses.rb +9 -8
- data/lib/fitting/report/test.rb +9 -11
- data/lib/fitting/report/tests.rb +10 -13
- data/lib/fitting/request.rb +0 -1
- data/lib/fitting/response.rb +4 -3
- data/lib/fitting/statistics/cover_error.rb +2 -0
- data/lib/fitting/statistics/cover_error_enum.rb +2 -0
- data/lib/fitting/statistics/cover_error_one_of.rb +2 -0
- data/lib/fitting/statistics/list.rb +5 -4
- data/lib/fitting/statistics/not_covered_responses.rb +1 -1
- data/lib/fitting/statistics/percent.rb +2 -1
- data/lib/fitting/statistics/template.rb +10 -8
- data/lib/fitting/storage/responses.rb +2 -2
- data/lib/fitting/storage/white_list.rb +7 -0
- data/lib/fitting/templates/realized_template.rb +2 -0
- data/lib/fitting/tests.rb +1 -1
- data/lib/fitting/version.rb +1 -1
- data/lib/fitting.rb +9 -6
- data/lib/tasks/fitting.rake +63 -54
- metadata +29 -42
- data/lib/fitting/configuration/legacy.rb +0 -60
| @@ -48,26 +48,28 @@ module Fitting | |
| 48 48 |  | 
| 49 49 | 
             
                  def white_measurement
         | 
| 50 50 | 
             
                    @white_measurement ||=
         | 
| 51 | 
            -
                       | 
| 51 | 
            +
                      case @depth
         | 
| 52 | 
            +
                      when 'valid'
         | 
| 52 53 | 
             
                        Fitting::Statistics::Measurement.new(white_unit)
         | 
| 53 | 
            -
                       | 
| 54 | 
            +
                      when 'cover'
         | 
| 54 55 | 
             
                        Fitting::Statistics::MeasurementCover.new(white_unit)
         | 
| 55 | 
            -
                       | 
| 56 | 
            +
                      when 'cover_enum'
         | 
| 56 57 | 
             
                        Fitting::Statistics::MeasurementCoverEnum.new(white_unit)
         | 
| 57 | 
            -
                       | 
| 58 | 
            +
                      when 'cover_one_of'
         | 
| 58 59 | 
             
                        Fitting::Statistics::MeasurementCoverOneOf.new(white_unit)
         | 
| 59 60 | 
             
                      end
         | 
| 60 61 | 
             
                  end
         | 
| 61 62 |  | 
| 62 63 | 
             
                  def black_measurement
         | 
| 63 64 | 
             
                    @black_measurement ||=
         | 
| 64 | 
            -
                       | 
| 65 | 
            +
                      case @depth
         | 
| 66 | 
            +
                      when 'valid'
         | 
| 65 67 | 
             
                        Fitting::Statistics::Measurement.new(black_unit)
         | 
| 66 | 
            -
                       | 
| 68 | 
            +
                      when 'cover'
         | 
| 67 69 | 
             
                        Fitting::Statistics::MeasurementCover.new(black_unit)
         | 
| 68 | 
            -
                       | 
| 70 | 
            +
                      when 'cover_enum'
         | 
| 69 71 | 
             
                        Fitting::Statistics::MeasurementCoverEnum.new(black_unit)
         | 
| 70 | 
            -
                       | 
| 72 | 
            +
                      when 'cover_one_of'
         | 
| 71 73 | 
             
                        Fitting::Statistics::MeasurementCoverOneOf.new(black_unit)
         | 
| 72 74 | 
             
                      end
         | 
| 73 75 | 
             
                  end
         | 
| @@ -9,8 +9,8 @@ module Fitting | |
| 9 9 | 
             
                    @tested_requests = []
         | 
| 10 10 | 
             
                  end
         | 
| 11 11 |  | 
| 12 | 
            -
                  def add(env_response,  | 
| 13 | 
            -
                    @tested_requests.push(Fitting::Records::Tested::Request.new(env_response,  | 
| 12 | 
            +
                  def add(env_response, metadata = {})
         | 
| 13 | 
            +
                    @tested_requests.push(Fitting::Records::Tested::Request.new(env_response, metadata))
         | 
| 14 14 | 
             
                  end
         | 
| 15 15 |  | 
| 16 16 | 
             
                  def statistics
         | 
| @@ -17,6 +17,7 @@ module Fitting | |
| 17 17 | 
             
                    return nil if @white_list == nil && @resource_white_list == nil && @include_resources == nil && @include_actions == nil
         | 
| 18 18 | 
             
                    return @white_list if @white_list
         | 
| 19 19 | 
             
                    return @white_list = transformation if @resource_white_list
         | 
| 20 | 
            +
             | 
| 20 21 | 
             
                    @white_list = {}
         | 
| 21 22 | 
             
                    @white_list.merge!(new_transformation) if @include_resources
         | 
| 22 23 | 
             
                    @white_list.merge!(postnew_transformation) if @include_actions
         | 
| @@ -25,6 +26,7 @@ module Fitting | |
| 25 26 |  | 
| 26 27 | 
             
                  def without_group
         | 
| 27 28 | 
             
                    return @without_group_list if @without_group_list
         | 
| 29 | 
            +
             | 
| 28 30 | 
             
                    @without_group_list = @resource_white_list.inject([]) do |all_requests, resource|
         | 
| 29 31 | 
             
                      resource_selection(resource, all_requests)
         | 
| 30 32 | 
             
                    end.flatten.uniq
         | 
| @@ -43,6 +45,7 @@ module Fitting | |
| 43 45 |  | 
| 44 46 | 
             
                  def find_warnings(resource)
         | 
| 45 47 | 
             
                    return nil if @resources[resource]
         | 
| 48 | 
            +
             | 
| 46 49 | 
             
                    @warnings.push(
         | 
| 47 50 | 
             
                      "FITTING WARNING: In the documentation there isn't resource from the resource_white_list #{resource}"
         | 
| 48 51 | 
             
                    )
         | 
| @@ -50,6 +53,7 @@ module Fitting | |
| 50 53 |  | 
| 51 54 | 
             
                  def puts_warnings
         | 
| 52 55 | 
             
                    return nil if @warnings == []
         | 
| 56 | 
            +
             | 
| 53 57 | 
             
                    warnings_string = @warnings.join("\n")
         | 
| 54 58 | 
             
                    puts "\n#{warnings_string}"
         | 
| 55 59 | 
             
                  end
         | 
| @@ -93,6 +97,7 @@ module Fitting | |
| 93 97 |  | 
| 94 98 | 
             
                  def new_without_group
         | 
| 95 99 | 
             
                    return @newwithout_group_list if @newwithout_group_list
         | 
| 100 | 
            +
             | 
| 96 101 | 
             
                    @newwithout_group_list = @include_resources.inject([]) do |all_requests, resource|
         | 
| 97 102 | 
             
                      if resource[0] == '/'
         | 
| 98 103 | 
             
                        new_resource_selection(resource, all_requests)
         | 
| @@ -120,6 +125,7 @@ module Fitting | |
| 120 125 |  | 
| 121 126 | 
             
                  def new_find_warnings(resource)
         | 
| 122 127 | 
             
                    return nil if @new_resources[resource]
         | 
| 128 | 
            +
             | 
| 123 129 | 
             
                    @warnings.push(
         | 
| 124 130 | 
             
                      "FITTING WARNING: In the documentation there isn't resource from the resource_white_list #{resource}"
         | 
| 125 131 | 
             
                    )
         | 
| @@ -135,6 +141,7 @@ module Fitting | |
| 135 141 |  | 
| 136 142 | 
             
                  def postnew_without_group
         | 
| 137 143 | 
             
                    return @postnewwithout_group_list if @postnewwithout_group_list
         | 
| 144 | 
            +
             | 
| 138 145 | 
             
                    @postnewwithout_group_list = @include_actions.inject([]) do |all_requests, resource|
         | 
| 139 146 | 
             
                      method, path = resource.split(' ')
         | 
| 140 147 | 
             
                      if path[0] == '/'
         | 
| @@ -27,8 +27,10 @@ module Fitting | |
| 27 27 | 
             
                      all_good = requests.all?(&:valid_json_schemas?)
         | 
| 28 28 | 
             
                      res += "path: #{key} #{all_good ? '✔' : '✖'}\n"
         | 
| 29 29 | 
             
                      next if all_good
         | 
| 30 | 
            +
             | 
| 30 31 | 
             
                      requests.map do |request|
         | 
| 31 32 | 
             
                        next if request.valid_json_schemas?
         | 
| 33 | 
            +
             | 
| 32 34 | 
             
                        res += "  full path: #{request.test_path} ✖\n"
         | 
| 33 35 | 
             
                        res += "    request.method #{request.method}\n"
         | 
| 34 36 | 
             
                        res += "    request.path #{request.path}\n"
         | 
    
        data/lib/fitting/tests.rb
    CHANGED
    
    | @@ -13,7 +13,7 @@ module Fitting | |
| 13 13 | 
             
                  end
         | 
| 14 14 | 
             
                  json = JSON.dump(array)
         | 
| 15 15 |  | 
| 16 | 
            -
                  File.open("fitting_tests/test#{ENV[ | 
| 16 | 
            +
                  File.open("fitting_tests/test#{ENV['TEST_ENV_NUMBER']}.json", 'w') { |file| file.write(json) }
         | 
| 17 17 | 
             
                end
         | 
| 18 18 |  | 
| 19 19 | 
             
                def make_dir(dir_name)
         | 
    
        data/lib/fitting/version.rb
    CHANGED
    
    
    
        data/lib/fitting.rb
    CHANGED
    
    | @@ -16,7 +16,6 @@ module Fitting | |
| 16 16 | 
             
                end
         | 
| 17 17 |  | 
| 18 18 | 
             
                def statistics
         | 
| 19 | 
            -
                  puts 'DEPRECATED: deprecated method statistics, use new method save_test_data'
         | 
| 20 19 | 
             
                  responses = Fitting::Storage::Responses.new
         | 
| 21 20 |  | 
| 22 21 | 
             
                  RSpec.configure do |config|
         | 
| @@ -30,18 +29,21 @@ module Fitting | |
| 30 29 | 
             
                  end
         | 
| 31 30 | 
             
                end
         | 
| 32 31 |  | 
| 32 | 
            +
                extend Gem::Deprecate
         | 
| 33 | 
            +
                deprecate :statistics, :save_test_data, 2022, 1
         | 
| 34 | 
            +
             | 
| 33 35 | 
             
                def save_test_data
         | 
| 34 36 | 
             
                  responses = Fitting::Storage::Responses.new
         | 
| 35 37 |  | 
| 36 | 
            -
                  FileUtils.rm_r Dir.glob( | 
| 38 | 
            +
                  FileUtils.rm_r Dir.glob('fitting_tests/*'), force: true
         | 
| 37 39 |  | 
| 38 40 | 
             
                  RSpec.configure do |config|
         | 
| 39 | 
            -
                    config.after(:each, type: :request) do
         | 
| 40 | 
            -
                      responses.add(response,  | 
| 41 | 
            +
                    config.after(:each, type: :request) do |example|
         | 
| 42 | 
            +
                      responses.add(response, example.metadata)
         | 
| 41 43 | 
             
                    end
         | 
| 42 44 |  | 
| 43 | 
            -
                    config.after(:each, type: :controller) do
         | 
| 44 | 
            -
                      responses.add(response,  | 
| 45 | 
            +
                    config.after(:each, type: :controller) do |example|
         | 
| 46 | 
            +
                      responses.add(response, example.metadata)
         | 
| 45 47 | 
             
                    end
         | 
| 46 48 |  | 
| 47 49 | 
             
                    config.after(:suite) do
         | 
| @@ -61,6 +63,7 @@ module Fitting | |
| 61 63 |  | 
| 62 64 | 
             
              def self.load_tasks
         | 
| 63 65 | 
             
                return if loaded_tasks
         | 
| 66 | 
            +
             | 
| 64 67 | 
             
                self.loaded_tasks = true
         | 
| 65 68 |  | 
| 66 69 | 
             
                Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each do |rake|
         | 
    
        data/lib/tasks/fitting.rake
    CHANGED
    
    | @@ -22,29 +22,33 @@ namespace :fitting do | |
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 24 | 
             
                prefixes.to_a.map do |prefix|
         | 
| 25 | 
            +
                  next if prefix.skip?
         | 
| 26 | 
            +
             | 
| 25 27 | 
             
                  prefix.actions.to_a.map do |action|
         | 
| 26 28 | 
             
                    action.responses.join(action.tests)
         | 
| 27 | 
            -
                  end | 
| 29 | 
            +
                  end
         | 
| 28 30 | 
             
                end
         | 
| 29 31 |  | 
| 30 32 | 
             
                prefixes.to_a.map do |prefix|
         | 
| 33 | 
            +
                  next if prefix.skip?
         | 
| 34 | 
            +
             | 
| 31 35 | 
             
                  prefix.actions.to_a.map do |action|
         | 
| 32 36 | 
             
                    action.responses.to_a.map do |response|
         | 
| 33 37 | 
             
                      response.combinations.join(response.tests)
         | 
| 34 38 | 
             
                    end
         | 
| 35 | 
            -
                  end | 
| 39 | 
            +
                  end
         | 
| 36 40 | 
             
                end
         | 
| 37 41 |  | 
| 38 42 | 
             
                report = JSON.pretty_generate(
         | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            +
                  {
         | 
| 44 | 
            +
                    tests_without_prefixes: tests.without_prefixes,
         | 
| 45 | 
            +
                    prefixes_details: prefixes.to_a.map(&:details)
         | 
| 46 | 
            +
                  }
         | 
| 43 47 | 
             
                )
         | 
| 44 48 |  | 
| 45 49 | 
             
                destination = 'fitting'
         | 
| 46 50 | 
             
                FileUtils.mkdir_p(destination)
         | 
| 47 | 
            -
                FileUtils.rm_r Dir.glob("#{destination}/*"), : | 
| 51 | 
            +
                FileUtils.rm_r Dir.glob("#{destination}/*"), force: true
         | 
| 48 52 | 
             
                File.open('fitting/report.json', 'w') { |file| file.write(report) }
         | 
| 49 53 |  | 
| 50 54 | 
             
                gem_path = $LOAD_PATH.find { |i| i.include?('fitting') }
         | 
| @@ -54,6 +58,8 @@ namespace :fitting do | |
| 54 58 | 
             
                json_schemas = {}
         | 
| 55 59 | 
             
                combinations = {}
         | 
| 56 60 | 
             
                prefixes.to_a.map do |prefix|
         | 
| 61 | 
            +
                  next if prefix.skip?
         | 
| 62 | 
            +
             | 
| 57 63 | 
             
                  prefix.actions.to_a.map do |action|
         | 
| 58 64 | 
             
                    action.responses.to_a.map do |response|
         | 
| 59 65 | 
             
                      json_schemas.merge!(response.id => response.body)
         | 
| @@ -61,80 +67,81 @@ namespace :fitting do | |
| 61 67 | 
             
                        combinations.merge!(combination.id => combination.json_schema)
         | 
| 62 68 | 
             
                      end
         | 
| 63 69 | 
             
                    end
         | 
| 64 | 
            -
                  end | 
| 70 | 
            +
                  end
         | 
| 65 71 | 
             
                end
         | 
| 66 72 | 
             
                File.open('fitting/json_schemas.json', 'w') { |file| file.write(JSON.pretty_generate(json_schemas)) }
         | 
| 67 73 | 
             
                File.open('fitting/combinations.json', 'w') { |file| file.write(JSON.pretty_generate(combinations)) }
         | 
| 68 74 | 
             
                File.open('fitting/tests.json', 'w') { |file| file.write(JSON.pretty_generate(tests.to_h)) }
         | 
| 69 75 |  | 
| 70 | 
            -
                js_path =  Dir["#{destination}/js/*"].find { |f| f[0..14] == 'fitting/js/app.' and f[-3 | 
| 76 | 
            +
                js_path =  Dir["#{destination}/js/*"].find { |f| f[0..14] == 'fitting/js/app.' and f[-3..] == '.js' }
         | 
| 71 77 | 
             
                js_file =  File.read(js_path)
         | 
| 72 | 
            -
                new_js_file = js_file.gsub( | 
| 73 | 
            -
                new_js_file = new_js_file.gsub( | 
| 74 | 
            -
                new_js_file = new_js_file.gsub( | 
| 75 | 
            -
                new_js_file = new_js_file.gsub( | 
| 76 | 
            -
                new_js_file = new_js_file.gsub( | 
| 78 | 
            +
                new_js_file = js_file.gsub('{stub:"prefixes report"}', report)
         | 
| 79 | 
            +
                new_js_file = new_js_file.gsub('{stub:"for action page"}', report)
         | 
| 80 | 
            +
                new_js_file = new_js_file.gsub('{stub:"json-schemas"}', JSON.pretty_generate(json_schemas))
         | 
| 81 | 
            +
                new_js_file = new_js_file.gsub('{stub:"combinations"}', JSON.pretty_generate(combinations))
         | 
| 82 | 
            +
                new_js_file = new_js_file.gsub('{stub:"tests"}', JSON.pretty_generate(tests.to_h))
         | 
| 77 83 | 
             
                File.open(js_path, 'w') { |file| file.write(new_js_file) }
         | 
| 78 84 |  | 
| 79 85 | 
             
                console = Fitting::Report::Console.new(
         | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 86 | 
            +
                  tests.without_prefixes,
         | 
| 87 | 
            +
                  prefixes.to_a.map(&:details)
         | 
| 82 88 | 
             
                )
         | 
| 83 89 |  | 
| 84 90 | 
             
                puts console.output
         | 
| 91 | 
            +
                puts console.output_sum
         | 
| 85 92 |  | 
| 86 93 | 
             
                exit 1 unless console.good?
         | 
| 87 94 |  | 
| 88 95 | 
             
                exit 0
         | 
| 89 96 |  | 
| 90 97 | 
             
                actions.map do |action|
         | 
| 91 | 
            -
                  action.to_hash[ | 
| 98 | 
            +
                  action.to_hash['responses'].map do |response|
         | 
| 92 99 | 
             
                    response['combination'] ||= []
         | 
| 93 | 
            -
                    combinations = Fitting::Cover::JSONSchema.new(response['body']).combi + | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 100 | 
            +
                    combinations = Fitting::Cover::JSONSchema.new(response['body']).combi +
         | 
| 101 | 
            +
                                   Fitting::Cover::JSONSchemaEnum.new(response['body']).combi +
         | 
| 102 | 
            +
                                   Fitting::Cover::JSONSchemaOneOf.new(response['body']).combi
         | 
| 103 | 
            +
                    next unless combinations != []
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                    combinations.map do |combination|
         | 
| 106 | 
            +
                      response['combination'].push(
         | 
| 107 | 
            +
                        {
         | 
| 108 | 
            +
                          'json_schema' => combination[0],
         | 
| 109 | 
            +
                          'type' => combination[1][0],
         | 
| 110 | 
            +
                          'combination' => combination[1][1],
         | 
| 111 | 
            +
                          'tests' => [],
         | 
| 112 | 
            +
                          'error' => []
         | 
| 113 | 
            +
                        }
         | 
| 114 | 
            +
                      )
         | 
| 106 115 | 
             
                    end
         | 
| 107 116 | 
             
                  end
         | 
| 108 117 | 
             
                end
         | 
| 109 118 |  | 
| 110 119 | 
             
                actions.map do |action|
         | 
| 111 | 
            -
                  action.to_hash[ | 
| 120 | 
            +
                  action.to_hash['responses'].map do |response|
         | 
| 112 121 | 
             
                    response['tests'] ||= []
         | 
| 113 122 | 
             
                    response['tests'].map do |test|
         | 
| 114 | 
            -
                       | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
                            end
         | 
| 125 | 
            -
                          rescue JSON::Schema::SchemaError => error
         | 
| 126 | 
            -
                            combination['error'].push({test: test, error: error})
         | 
| 127 | 
            -
                          end
         | 
| 123 | 
            +
                      next unless response['combination'][0]
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                      response['combination'].map do |combination|
         | 
| 126 | 
            +
                        res = JSON::Validator.fully_validate(combination['json_schema'], test['response']['body'])
         | 
| 127 | 
            +
                        if res == []
         | 
| 128 | 
            +
                          combination['tests'].push(test)
         | 
| 129 | 
            +
                          response['tests'] = response['tests'] - [test]
         | 
| 130 | 
            +
                          next
         | 
| 131 | 
            +
                        else
         | 
| 132 | 
            +
                          combination['error'].push({ test: test, error: res })
         | 
| 128 133 | 
             
                        end
         | 
| 134 | 
            +
                      rescue JSON::Schema::SchemaError => e
         | 
| 135 | 
            +
                        combination['error'].push({ test: test, error: e })
         | 
| 129 136 | 
             
                      end
         | 
| 130 137 | 
             
                    end
         | 
| 131 138 | 
             
                  end
         | 
| 132 139 | 
             
                end
         | 
| 133 140 |  | 
| 134 | 
            -
                actions_test = {actions: actions, tests: tests}
         | 
| 141 | 
            +
                actions_test = { actions: actions, tests: tests }
         | 
| 135 142 |  | 
| 136 143 | 
             
                makedirs('fitting')
         | 
| 137 | 
            -
                File.open('fitting/old_report.json', 'w') { |file| file.write( | 
| 144 | 
            +
                File.open('fitting/old_report.json', 'w') { |file| file.write(JSON.dump(actions_test)) }
         | 
| 138 145 | 
             
              end
         | 
| 139 146 |  | 
| 140 147 | 
             
              # deprecated
         | 
| @@ -154,7 +161,8 @@ namespace :fitting do | |
| 154 161 |  | 
| 155 162 | 
             
              desc 'Fitting documentation responses cover'
         | 
| 156 163 | 
             
              task :documentation_responses, [:size] => :environment do |_, args|
         | 
| 157 | 
            -
                 | 
| 164 | 
            +
                case args.size
         | 
| 165 | 
            +
                when 'xs'
         | 
| 158 166 | 
             
                  documented_unit = Fitting::Statistics::Template.new(
         | 
| 159 167 | 
             
                    Fitting::Records::Spherical::Requests.new,
         | 
| 160 168 | 
             
                    Fitting.configuration
         | 
| @@ -165,7 +173,7 @@ namespace :fitting do | |
| 165 173 | 
             
                    puts 'Not all responses from the whitelist are covered!'
         | 
| 166 174 | 
             
                    exit 1
         | 
| 167 175 | 
             
                  end
         | 
| 168 | 
            -
                 | 
| 176 | 
            +
                when 's'
         | 
| 169 177 | 
             
                  documented_unit = Fitting::Statistics::Template.new(
         | 
| 170 178 | 
             
                    Fitting::Records::Spherical::Requests.new,
         | 
| 171 179 | 
             
                    Fitting.configuration,
         | 
| @@ -177,7 +185,7 @@ namespace :fitting do | |
| 177 185 | 
             
                    puts 'Not all responses from the whitelist are covered!'
         | 
| 178 186 | 
             
                    exit 1
         | 
| 179 187 | 
             
                  end
         | 
| 180 | 
            -
                 | 
| 188 | 
            +
                when 'm'
         | 
| 181 189 | 
             
                  documented_unit = Fitting::Statistics::Template.new(
         | 
| 182 190 | 
             
                    Fitting::Records::Spherical::Requests.new,
         | 
| 183 191 | 
             
                    Fitting.configuration,
         | 
| @@ -189,7 +197,7 @@ namespace :fitting do | |
| 189 197 | 
             
                    puts 'Not all responses from the whitelist are covered!'
         | 
| 190 198 | 
             
                    exit 1
         | 
| 191 199 | 
             
                  end
         | 
| 192 | 
            -
                 | 
| 200 | 
            +
                when 'l'
         | 
| 193 201 | 
             
                  documented_unit = Fitting::Statistics::Template.new(
         | 
| 194 202 | 
             
                    Fitting::Records::Spherical::Requests.new,
         | 
| 195 203 | 
             
                    Fitting.configuration,
         | 
| @@ -208,19 +216,20 @@ namespace :fitting do | |
| 208 216 |  | 
| 209 217 | 
             
              desc 'Fitting documentation responses cover error'
         | 
| 210 218 | 
             
              task :documentation_responses_error, [:size] => :environment do |_, args|
         | 
| 211 | 
            -
                 | 
| 219 | 
            +
                case args.size
         | 
| 220 | 
            +
                when 's'
         | 
| 212 221 | 
             
                  documented_unit = Fitting::Statistics::TemplateCoverError.new(
         | 
| 213 222 | 
             
                    Fitting::Records::Spherical::Requests.new,
         | 
| 214 223 | 
             
                    Fitting.configuration
         | 
| 215 224 | 
             
                  )
         | 
| 216 225 | 
             
                  puts documented_unit.stats
         | 
| 217 | 
            -
                 | 
| 226 | 
            +
                when 'm'
         | 
| 218 227 | 
             
                  documented_unit = Fitting::Statistics::TemplateCoverErrorEnum.new(
         | 
| 219 228 | 
             
                    Fitting::Records::Spherical::Requests.new,
         | 
| 220 229 | 
             
                    Fitting.configuration
         | 
| 221 230 | 
             
                  )
         | 
| 222 231 | 
             
                  puts documented_unit.stats
         | 
| 223 | 
            -
                 | 
| 232 | 
            +
                when 'l'
         | 
| 224 233 | 
             
                  documented_unit = Fitting::Statistics::TemplateCoverErrorOneOf.new(
         | 
| 225 234 | 
             
                    Fitting::Records::Spherical::Requests.new,
         | 
| 226 235 | 
             
                    Fitting.configuration
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: fitting
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.18.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - d.efimov
         | 
| 8 | 
            -
            autorequire:
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021- | 
| 11 | 
            +
            date: 2021-11-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: json-schema
         | 
| @@ -31,19 +31,25 @@ dependencies: | |
| 31 31 | 
             
                  - !ruby/object:Gem::Version
         | 
| 32 32 | 
             
                    version: 2.6.2
         | 
| 33 33 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 34 | 
            -
              name:  | 
| 34 | 
            +
              name: terminal-table
         | 
| 35 35 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 36 36 | 
             
                requirements:
         | 
| 37 37 | 
             
                - - "~>"
         | 
| 38 38 | 
             
                  - !ruby/object:Gem::Version
         | 
| 39 | 
            -
                    version: ' | 
| 39 | 
            +
                    version: '3.0'
         | 
| 40 | 
            +
                - - ">="
         | 
| 41 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 42 | 
            +
                    version: 3.0.2
         | 
| 40 43 | 
             
              type: :runtime
         | 
| 41 44 | 
             
              prerelease: false
         | 
| 42 45 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 43 46 | 
             
                requirements:
         | 
| 44 47 | 
             
                - - "~>"
         | 
| 45 48 | 
             
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            -
                    version: ' | 
| 49 | 
            +
                    version: '3.0'
         | 
| 50 | 
            +
                - - ">="
         | 
| 51 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 52 | 
            +
                    version: 3.0.2
         | 
| 47 53 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 48 54 | 
             
              name: tomograph
         | 
| 49 55 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -84,100 +90,82 @@ dependencies: | |
| 84 90 | 
             
                requirements:
         | 
| 85 91 | 
             
                - - "~>"
         | 
| 86 92 | 
             
                  - !ruby/object:Gem::Version
         | 
| 87 | 
            -
                    version: ' | 
| 93 | 
            +
                    version: '11.1'
         | 
| 88 94 | 
             
                - - ">="
         | 
| 89 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 90 | 
            -
                    version:  | 
| 96 | 
            +
                    version: 11.1.3
         | 
| 91 97 | 
             
              type: :development
         | 
| 92 98 | 
             
              prerelease: false
         | 
| 93 99 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 94 100 | 
             
                requirements:
         | 
| 95 101 | 
             
                - - "~>"
         | 
| 96 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 97 | 
            -
                    version: ' | 
| 103 | 
            +
                    version: '11.1'
         | 
| 98 104 | 
             
                - - ">="
         | 
| 99 105 | 
             
                  - !ruby/object:Gem::Version
         | 
| 100 | 
            -
                    version:  | 
| 106 | 
            +
                    version: 11.1.3
         | 
| 101 107 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 102 108 | 
             
              name: rake
         | 
| 103 109 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 104 110 | 
             
                requirements:
         | 
| 105 111 | 
             
                - - "~>"
         | 
| 106 112 | 
             
                  - !ruby/object:Gem::Version
         | 
| 107 | 
            -
                    version: ' | 
| 113 | 
            +
                    version: '13.0'
         | 
| 108 114 | 
             
                - - ">="
         | 
| 109 115 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version:  | 
| 116 | 
            +
                    version: 13.0.6
         | 
| 111 117 | 
             
              type: :development
         | 
| 112 118 | 
             
              prerelease: false
         | 
| 113 119 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 114 120 | 
             
                requirements:
         | 
| 115 121 | 
             
                - - "~>"
         | 
| 116 122 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: ' | 
| 123 | 
            +
                    version: '13.0'
         | 
| 118 124 | 
             
                - - ">="
         | 
| 119 125 | 
             
                  - !ruby/object:Gem::Version
         | 
| 120 | 
            -
                    version:  | 
| 126 | 
            +
                    version: 13.0.6
         | 
| 121 127 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 122 128 | 
             
              name: rspec
         | 
| 123 129 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 124 130 | 
             
                requirements:
         | 
| 125 | 
            -
                - - ">="
         | 
| 126 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 127 | 
            -
                    version: 3.4.0
         | 
| 128 131 | 
             
                - - "~>"
         | 
| 129 132 | 
             
                  - !ruby/object:Gem::Version
         | 
| 130 | 
            -
                    version: '3. | 
| 133 | 
            +
                    version: '3.10'
         | 
| 131 134 | 
             
              type: :development
         | 
| 132 135 | 
             
              prerelease: false
         | 
| 133 136 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 134 137 | 
             
                requirements:
         | 
| 135 | 
            -
                - - ">="
         | 
| 136 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 137 | 
            -
                    version: 3.4.0
         | 
| 138 138 | 
             
                - - "~>"
         | 
| 139 139 | 
             
                  - !ruby/object:Gem::Version
         | 
| 140 | 
            -
                    version: '3. | 
| 140 | 
            +
                    version: '3.10'
         | 
| 141 141 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 142 142 | 
             
              name: rubocop
         | 
| 143 143 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 144 144 | 
             
                requirements:
         | 
| 145 | 
            -
                - - ">="
         | 
| 146 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 147 | 
            -
                    version: 0.49.1
         | 
| 148 145 | 
             
                - - "~>"
         | 
| 149 146 | 
             
                  - !ruby/object:Gem::Version
         | 
| 150 | 
            -
                    version:  | 
| 147 | 
            +
                    version: 1.22.0
         | 
| 151 148 | 
             
              type: :development
         | 
| 152 149 | 
             
              prerelease: false
         | 
| 153 150 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 154 151 | 
             
                requirements:
         | 
| 155 | 
            -
                - - ">="
         | 
| 156 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 157 | 
            -
                    version: 0.49.1
         | 
| 158 152 | 
             
                - - "~>"
         | 
| 159 153 | 
             
                  - !ruby/object:Gem::Version
         | 
| 160 | 
            -
                    version:  | 
| 154 | 
            +
                    version: 1.22.0
         | 
| 161 155 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 162 156 | 
             
              name: simplecov
         | 
| 163 157 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 164 158 | 
             
                requirements:
         | 
| 165 159 | 
             
                - - "~>"
         | 
| 166 160 | 
             
                  - !ruby/object:Gem::Version
         | 
| 167 | 
            -
                    version: '0. | 
| 168 | 
            -
                - - ">="
         | 
| 169 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 170 | 
            -
                    version: 0.11.2
         | 
| 161 | 
            +
                    version: '0.21'
         | 
| 171 162 | 
             
              type: :development
         | 
| 172 163 | 
             
              prerelease: false
         | 
| 173 164 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 174 165 | 
             
                requirements:
         | 
| 175 166 | 
             
                - - "~>"
         | 
| 176 167 | 
             
                  - !ruby/object:Gem::Version
         | 
| 177 | 
            -
                    version: '0. | 
| 178 | 
            -
                - - ">="
         | 
| 179 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 180 | 
            -
                    version: 0.11.2
         | 
| 168 | 
            +
                    version: '0.21'
         | 
| 181 169 | 
             
            description: Coverage API Blueprint, Swagger and OpenAPI with RSpec for easily make
         | 
| 182 170 | 
             
              high-quality API and documenatiton
         | 
| 183 171 | 
             
            email:
         | 
| @@ -205,7 +193,6 @@ files: | |
| 205 193 | 
             
            - images/logo.png
         | 
| 206 194 | 
             
            - lib/fitting.rb
         | 
| 207 195 | 
             
            - lib/fitting/configuration.rb
         | 
| 208 | 
            -
            - lib/fitting/configuration/legacy.rb
         | 
| 209 196 | 
             
            - lib/fitting/configuration/yaml.rb
         | 
| 210 197 | 
             
            - lib/fitting/cover/json_schema.rb
         | 
| 211 198 | 
             
            - lib/fitting/cover/json_schema_enum.rb
         | 
| @@ -296,7 +283,7 @@ homepage: https://github.com/funbox/fitting | |
| 296 283 | 
             
            licenses:
         | 
| 297 284 | 
             
            - MIT
         | 
| 298 285 | 
             
            metadata: {}
         | 
| 299 | 
            -
            post_install_message:
         | 
| 286 | 
            +
            post_install_message: 
         | 
| 300 287 | 
             
            rdoc_options: []
         | 
| 301 288 | 
             
            require_paths:
         | 
| 302 289 | 
             
            - lib
         | 
| @@ -304,7 +291,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 304 291 | 
             
              requirements:
         | 
| 305 292 | 
             
              - - ">="
         | 
| 306 293 | 
             
                - !ruby/object:Gem::Version
         | 
| 307 | 
            -
                  version:  | 
| 294 | 
            +
                  version: 2.6.0
         | 
| 308 295 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 309 296 | 
             
              requirements:
         | 
| 310 297 | 
             
              - - ">="
         | 
| @@ -312,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 312 299 | 
             
                  version: '0'
         | 
| 313 300 | 
             
            requirements: []
         | 
| 314 301 | 
             
            rubygems_version: 3.0.1
         | 
| 315 | 
            -
            signing_key:
         | 
| 302 | 
            +
            signing_key: 
         | 
| 316 303 | 
             
            specification_version: 4
         | 
| 317 304 | 
             
            summary: Coverage API Blueprint, Swagger and OpenAPI with RSpec
         | 
| 318 305 | 
             
            test_files: []
         | 
| @@ -1,60 +0,0 @@ | |
| 1 | 
            -
            require 'tomograph'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Fitting
         | 
| 4 | 
            -
              class Configuration
         | 
| 5 | 
            -
                class Legacy
         | 
| 6 | 
            -
                  attr_accessor :apib_path,
         | 
| 7 | 
            -
                                :drafter_yaml_path,
         | 
| 8 | 
            -
                                :crafter_apib_path,
         | 
| 9 | 
            -
                                :crafter_yaml_path,
         | 
| 10 | 
            -
                                :drafter_4_apib_path,
         | 
| 11 | 
            -
                                :drafter_4_yaml_path,
         | 
| 12 | 
            -
                                :strict,
         | 
| 13 | 
            -
                                :prefix,
         | 
| 14 | 
            -
                                :white_list,
         | 
| 15 | 
            -
                                :resource_white_list,
         | 
| 16 | 
            -
                                :ignore_list,
         | 
| 17 | 
            -
                                :include_resources,
         | 
| 18 | 
            -
                                :include_actions
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                  def initialize
         | 
| 21 | 
            -
                    @strict = false
         | 
| 22 | 
            -
                    @prefix = ''
         | 
| 23 | 
            -
                    @ignore_list = []
         | 
| 24 | 
            -
                  end
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                  def tomogram
         | 
| 27 | 
            -
                    @tomogram ||= if @crafter_apib_path || @crafter_yaml_path
         | 
| 28 | 
            -
                                    Tomograph::Tomogram.new(
         | 
| 29 | 
            -
                                      prefix: @prefix,
         | 
| 30 | 
            -
                                      crafter_apib_path: @crafter_apib_path,
         | 
| 31 | 
            -
                                      crafter_yaml_path: @crafter_yaml_path
         | 
| 32 | 
            -
                                    )
         | 
| 33 | 
            -
                                  elsif @drafter_4_apib_path || @drafter_4_yaml_path
         | 
| 34 | 
            -
                                    Tomograph::Tomogram.new(
         | 
| 35 | 
            -
                                      prefix: @prefix,
         | 
| 36 | 
            -
                                      drafter_4_apib_path: @drafter_4_apib_path,
         | 
| 37 | 
            -
                                      drafter_4_yaml_path: @drafter_4_yaml_path
         | 
| 38 | 
            -
                                    )
         | 
| 39 | 
            -
                                  else Tomograph::Tomogram.new(
         | 
| 40 | 
            -
                                    prefix: @prefix,
         | 
| 41 | 
            -
                                    apib_path: @apib_path,
         | 
| 42 | 
            -
                                    drafter_yaml_path: @drafter_yaml_path
         | 
| 43 | 
            -
                                  )
         | 
| 44 | 
            -
                                  end
         | 
| 45 | 
            -
                  end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
                  def title
         | 
| 48 | 
            -
                    'fitting'
         | 
| 49 | 
            -
                  end
         | 
| 50 | 
            -
             | 
| 51 | 
            -
                  def stats_path
         | 
| 52 | 
            -
                    'fitting/stats'
         | 
| 53 | 
            -
                  end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                  def not_covered_path
         | 
| 56 | 
            -
                    'fitting/not_covered'
         | 
| 57 | 
            -
                  end
         | 
| 58 | 
            -
                end
         | 
| 59 | 
            -
              end
         | 
| 60 | 
            -
            end
         |