fitting 2.18.2 → 3.0.2

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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -11
  3. data/CHANGELOG.md +21 -0
  4. data/README.md +46 -6
  5. data/fitting.gemspec +3 -1
  6. data/lib/fitting/configuration.rb +12 -6
  7. data/lib/fitting/cover/json_schema.rb +4 -2
  8. data/lib/fitting/cover/json_schema_enum.rb +4 -2
  9. data/lib/fitting/cover/json_schema_one_of.rb +4 -2
  10. data/lib/fitting/railtie.rb +1 -0
  11. data/lib/fitting/records/documented/request.rb +1 -15
  12. data/lib/fitting/records/spherical/requests.rb +1 -1
  13. data/lib/fitting/records/tested/request.rb +11 -11
  14. data/lib/fitting/records/tested/response.rb +4 -4
  15. data/lib/fitting/report/actions.rb +4 -0
  16. data/lib/fitting/report/console.rb +32 -12
  17. data/lib/fitting/report/prefix.rb +20 -41
  18. data/lib/fitting/report/prefixes.rb +7 -8
  19. data/lib/fitting/report/response.rb +0 -3
  20. data/lib/fitting/report/tests.rb +23 -10
  21. data/lib/fitting/storage/responses.rb +5 -9
  22. data/lib/fitting/tests.rb +12 -4
  23. data/lib/fitting/version.rb +1 -1
  24. data/lib/fitting.rb +38 -43
  25. data/lib/tasks/fitting.rake +3 -186
  26. data/lib/tasks/fitting_outgoing.rake +91 -0
  27. metadata +25 -41
  28. data/lib/fitting/configuration/yaml.rb +0 -89
  29. data/lib/fitting/cover/response.rb +0 -37
  30. data/lib/fitting/documentation.rb +0 -56
  31. data/lib/fitting/matchers/response_matcher.rb +0 -88
  32. data/lib/fitting/records/realized_unit.rb +0 -52
  33. data/lib/fitting/records/test_unit/request.rb +0 -98
  34. data/lib/fitting/records/unit/combination.rb +0 -27
  35. data/lib/fitting/records/unit/json_schema.rb +0 -111
  36. data/lib/fitting/records/unit/request.rb +0 -37
  37. data/lib/fitting/records/unit/response.rb +0 -32
  38. data/lib/fitting/request.rb +0 -38
  39. data/lib/fitting/response/fully_validates.rb +0 -34
  40. data/lib/fitting/response.rb +0 -88
  41. data/lib/fitting/statistics/analysis.rb +0 -25
  42. data/lib/fitting/statistics/cover_error.rb +0 -29
  43. data/lib/fitting/statistics/cover_error_enum.rb +0 -29
  44. data/lib/fitting/statistics/cover_error_one_of.rb +0 -29
  45. data/lib/fitting/statistics/great.rb +0 -13
  46. data/lib/fitting/statistics/list.rb +0 -55
  47. data/lib/fitting/statistics/lists.rb +0 -53
  48. data/lib/fitting/statistics/measurement.rb +0 -92
  49. data/lib/fitting/statistics/measurement_cover.rb +0 -92
  50. data/lib/fitting/statistics/measurement_cover_enum.rb +0 -92
  51. data/lib/fitting/statistics/measurement_cover_one_of.rb +0 -92
  52. data/lib/fitting/statistics/not_covered_responses.rb +0 -13
  53. data/lib/fitting/statistics/percent.rb +0 -20
  54. data/lib/fitting/statistics/requests_stats.rb +0 -40
  55. data/lib/fitting/statistics/responses_stats.rb +0 -32
  56. data/lib/fitting/statistics/template.rb +0 -117
  57. data/lib/fitting/statistics/template_cover_error.rb +0 -50
  58. data/lib/fitting/statistics/template_cover_error_enum.rb +0 -50
  59. data/lib/fitting/statistics/template_cover_error_one_of.rb +0 -50
  60. data/lib/fitting/statistics.rb +0 -25
  61. data/lib/fitting/storage/white_list.rb +0 -158
  62. data/lib/fitting/templates/realized_template.rb +0 -49
  63. data/lib/fitting/view/report.html.haml +0 -16
  64. data/lib/fitting/view/style.css +0 -47
@@ -1,24 +1,20 @@
1
- require 'fitting/statistics'
2
- require 'fitting/tests'
3
1
  require 'fitting/records/tested/request'
4
2
 
5
3
  module Fitting
6
4
  module Storage
7
5
  class Responses
6
+ attr_reader :tested_requests
7
+
8
8
  def initialize
9
9
  @tested_requests = []
10
10
  end
11
11
 
12
- def add(env_response, metadata = {})
13
- @tested_requests.push(Fitting::Records::Tested::Request.new(env_response, metadata))
14
- end
15
-
16
- def statistics
17
- Fitting::Statistics.new(@tested_requests)
12
+ def add(response, example)
13
+ tested_requests.push(Fitting::Records::Tested::Request.new(response, example))
18
14
  end
19
15
 
20
16
  def tests
21
- Fitting::Tests.new(@tested_requests)
17
+ Fitting::Tests.new(tested_requests)
22
18
  end
23
19
  end
24
20
  end
data/lib/fitting/tests.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'fitting/statistics/template'
2
-
3
1
  module Fitting
4
2
  class Tests
5
3
  def initialize(tested_requests)
@@ -7,13 +5,23 @@ module Fitting
7
5
  end
8
6
 
9
7
  def save
10
- make_dir('fitting_tests')
8
+ make_dir(Fitting.configuration.rspec_json_path)
9
+ array = @tested_requests.inject([]) do |res, request|
10
+ res.push(request.to_spherical.to_hash)
11
+ end
12
+ json = JSON.dump(array)
13
+
14
+ File.open("#{Fitting.configuration.rspec_json_path}/test#{ENV['TEST_ENV_NUMBER']}.json", 'w') { |file| file.write(json) }
15
+ end
16
+
17
+ def outgoing_save
18
+ make_dir('./outgoing_request_tests')
11
19
  array = @tested_requests.inject([]) do |res, request|
12
20
  res.push(request.to_spherical.to_hash)
13
21
  end
14
22
  json = JSON.dump(array)
15
23
 
16
- File.open("fitting_tests/test#{ENV['TEST_ENV_NUMBER']}.json", 'w') { |file| file.write(json) }
24
+ File.open("./outgoing_request_tests/test#{ENV['TEST_ENV_NUMBER']}.json", 'w') { |file| file.write(json) }
17
25
  end
18
26
 
19
27
  def make_dir(dir_name)
@@ -1,3 +1,3 @@
1
1
  module Fitting
2
- VERSION = '2.18.2'.freeze
2
+ VERSION = '3.0.2'.freeze
3
3
  end
data/lib/fitting.rb CHANGED
@@ -1,73 +1,68 @@
1
+ require 'json-schema'
1
2
  require 'fitting/version'
2
3
  require 'fitting/configuration'
3
- require 'fitting/matchers/response_matcher'
4
- require 'fitting/documentation'
5
4
  require 'fitting/storage/responses'
5
+ require 'fitting/tests'
6
+ require 'fitting/cover/json_schema_enum'
7
+ require 'fitting/cover/json_schema_one_of'
8
+ require 'fitting/records/documented/request'
6
9
  require 'fitting/railtie' if defined?(Rails)
7
10
 
8
11
  module Fitting
9
12
  class << self
10
- def configure
11
- yield configuration
12
- end
13
-
14
13
  def configuration
15
- @configuration ||= Configuration.craft
14
+ yaml = YAML.safe_load(File.read('.fitting.yml'))
15
+ @configuration ||= Configuration.new(yaml)
16
16
  end
17
17
 
18
- def statistics
19
- responses = Fitting::Storage::Responses.new
20
-
21
- RSpec.configure do |config|
22
- config.after(:each, type: :controller) do
23
- responses.add(response, inspect)
24
- end
25
-
26
- config.after(:suite) do
27
- responses.statistics.save
28
- end
29
- end
18
+ def configure
19
+ yield(configuration)
30
20
  end
31
21
 
32
- extend Gem::Deprecate
33
- deprecate :statistics, :save_test_data, 2022, 1
22
+ def clear_tests_directory
23
+ FileUtils.rm_r Dir.glob(configuration.rspec_json_path), force: true
24
+ FileUtils.rm_r Dir.glob(configuration.webmock_json_path), force: true
25
+ end
34
26
 
35
27
  def save_test_data
36
- responses = Fitting::Storage::Responses.new
28
+ clear_tests_directory
37
29
 
38
- FileUtils.rm_r Dir.glob('fitting_tests/*'), force: true
30
+ outgoing_responses = Fitting::Storage::Responses.new
31
+ responses = Fitting::Storage::Responses.new
39
32
 
40
33
  RSpec.configure do |config|
34
+ if defined?(WebMock)
35
+ config.before(:each) do |example|
36
+ WebMock.after_request do |request_signature, response|
37
+ env = Rack::MockRequest.env_for(request_signature.uri, { method: request_signature.method })
38
+ # Парсим в тот формат с которым работает fitting
39
+ mock_request = ActionDispatch::Request.new(env)
40
+ mock_response = ActionDispatch::Response.create(response.status.first || 200, response.headers || {},
41
+ response.body || {})
42
+ mock_response.instance_variable_set(:@request, mock_request)
43
+
44
+ outgoing_responses.add(mock_response, example)
45
+ end
46
+ end
47
+ end
48
+
41
49
  config.after(:each, type: :request) do |example|
42
- responses.add(response, example.metadata)
50
+ responses.add(response, example)
43
51
  end
44
52
 
45
53
  config.after(:each, type: :controller) do |example|
46
- responses.add(response, example.metadata)
54
+ responses.add(response, example)
55
+ end
56
+
57
+ config.after(:each) do
58
+ WebMock::CallbackRegistry.reset
47
59
  end
48
60
 
49
61
  config.after(:suite) do
50
62
  responses.tests.save
63
+ outgoing_responses.tests.outgoing_save
51
64
  end
52
65
  end
53
66
  end
54
67
  end
55
-
56
- def self.loaded_tasks=(val)
57
- @loaded_tasks = val
58
- end
59
-
60
- def self.loaded_tasks
61
- @loaded_tasks
62
- end
63
-
64
- def self.load_tasks
65
- return if loaded_tasks
66
-
67
- self.loaded_tasks = true
68
-
69
- Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each do |rake|
70
- load rake
71
- end
72
- end
73
68
  end
@@ -1,10 +1,4 @@
1
1
  require 'fitting/records/spherical/requests'
2
- require 'fitting/configuration'
3
- require 'fitting/records/realized_unit'
4
- require 'fitting/templates/realized_template'
5
- require 'fitting/statistics/template_cover_error'
6
- require 'fitting/statistics/template_cover_error_enum'
7
- require 'fitting/statistics/template_cover_error_one_of'
8
2
  require 'fitting/cover/json_schema'
9
3
  require 'fitting/report/prefixes'
10
4
  require 'fitting/report/tests'
@@ -12,8 +6,8 @@ require 'fitting/report/console'
12
6
 
13
7
  namespace :fitting do
14
8
  task :report do
15
- tests = Fitting::Report::Tests.new_from_config('fitting_tests/*.json')
16
- prefixes = Fitting::Report::Prefixes.new('.fitting.yml')
9
+ tests = Fitting::Report::Tests.new_from_config
10
+ prefixes = Fitting::Report::Prefixes.new(Fitting.configuration.prefixes)
17
11
 
18
12
  prefixes.join(tests)
19
13
 
@@ -88,187 +82,10 @@ namespace :fitting do
88
82
  )
89
83
 
90
84
  puts console.output
85
+ puts console.output_sum
91
86
 
92
87
  exit 1 unless console.good?
93
88
 
94
89
  exit 0
95
-
96
- actions.map do |action|
97
- action.to_hash['responses'].map do |response|
98
- response['combination'] ||= []
99
- combinations = Fitting::Cover::JSONSchema.new(response['body']).combi +
100
- Fitting::Cover::JSONSchemaEnum.new(response['body']).combi +
101
- Fitting::Cover::JSONSchemaOneOf.new(response['body']).combi
102
- next unless combinations != []
103
-
104
- combinations.map do |combination|
105
- response['combination'].push(
106
- {
107
- 'json_schema' => combination[0],
108
- 'type' => combination[1][0],
109
- 'combination' => combination[1][1],
110
- 'tests' => [],
111
- 'error' => []
112
- }
113
- )
114
- end
115
- end
116
- end
117
-
118
- actions.map do |action|
119
- action.to_hash['responses'].map do |response|
120
- response['tests'] ||= []
121
- response['tests'].map do |test|
122
- next unless response['combination'][0]
123
-
124
- response['combination'].map do |combination|
125
- res = JSON::Validator.fully_validate(combination['json_schema'], test['response']['body'])
126
- if res == []
127
- combination['tests'].push(test)
128
- response['tests'] = response['tests'] - [test]
129
- next
130
- else
131
- combination['error'].push({ test: test, error: res })
132
- end
133
- rescue JSON::Schema::SchemaError => e
134
- combination['error'].push({ test: test, error: e })
135
- end
136
- end
137
- end
138
- end
139
-
140
- actions_test = { actions: actions, tests: tests }
141
-
142
- makedirs('fitting')
143
- File.open('fitting/old_report.json', 'w') { |file| file.write(JSON.dump(actions_test)) }
144
- end
145
-
146
- # deprecated
147
- desc 'Fitting documentation'
148
- task :documentation do
149
- documented_unit = Fitting::Statistics::Template.new(
150
- Fitting::Records::Spherical::Requests.new,
151
- Fitting.configuration
152
- )
153
- puts documented_unit.stats
154
-
155
- unless documented_unit.not_covered == "\n"
156
- puts 'Not all responses from the whitelist are covered!'
157
- exit 1
158
- end
159
- end
160
-
161
- desc 'Fitting documentation responses cover'
162
- task :documentation_responses, [:size] => :environment do |_, args|
163
- case args.size
164
- when 'xs'
165
- documented_unit = Fitting::Statistics::Template.new(
166
- Fitting::Records::Spherical::Requests.new,
167
- Fitting.configuration
168
- )
169
- puts documented_unit.stats
170
-
171
- unless documented_unit.not_covered == "\n"
172
- puts 'Not all responses from the whitelist are covered!'
173
- exit 1
174
- end
175
- when 's'
176
- documented_unit = Fitting::Statistics::Template.new(
177
- Fitting::Records::Spherical::Requests.new,
178
- Fitting.configuration,
179
- 'cover'
180
- )
181
- puts documented_unit.stats
182
-
183
- unless documented_unit.not_covered == "\n"
184
- puts 'Not all responses from the whitelist are covered!'
185
- exit 1
186
- end
187
- when 'm'
188
- documented_unit = Fitting::Statistics::Template.new(
189
- Fitting::Records::Spherical::Requests.new,
190
- Fitting.configuration,
191
- 'cover_enum'
192
- )
193
- puts documented_unit.stats
194
-
195
- unless documented_unit.not_covered == "\n"
196
- puts 'Not all responses from the whitelist are covered!'
197
- exit 1
198
- end
199
- when 'l'
200
- documented_unit = Fitting::Statistics::Template.new(
201
- Fitting::Records::Spherical::Requests.new,
202
- Fitting.configuration,
203
- 'cover_one_of'
204
- )
205
- puts documented_unit.stats
206
-
207
- unless documented_unit.not_covered == "\n"
208
- puts 'Not all responses from the whitelist are covered!'
209
- exit 1
210
- end
211
- else
212
- puts 'need key xs, s, m or l'
213
- end
214
- end
215
-
216
- desc 'Fitting documentation responses cover error'
217
- task :documentation_responses_error, [:size] => :environment do |_, args|
218
- case args.size
219
- when 's'
220
- documented_unit = Fitting::Statistics::TemplateCoverError.new(
221
- Fitting::Records::Spherical::Requests.new,
222
- Fitting.configuration
223
- )
224
- puts documented_unit.stats
225
- when 'm'
226
- documented_unit = Fitting::Statistics::TemplateCoverErrorEnum.new(
227
- Fitting::Records::Spherical::Requests.new,
228
- Fitting.configuration
229
- )
230
- puts documented_unit.stats
231
- when 'l'
232
- documented_unit = Fitting::Statistics::TemplateCoverErrorOneOf.new(
233
- Fitting::Records::Spherical::Requests.new,
234
- Fitting.configuration
235
- )
236
- puts documented_unit.stats
237
- else
238
- puts 'need key s, m or l'
239
- end
240
- end
241
-
242
- # deprecated
243
- desc 'Fitting tests'
244
- task :tests do
245
- realized_unit = Fitting::Records::RealizedUnit.new(
246
- Fitting::Records::Spherical::Requests.new,
247
- Fitting.configuration.tomogram
248
- )
249
- puts Fitting::Templates::RealizedTemplate.new(realized_unit).to_s
250
-
251
- unless realized_unit.fully_covered?
252
- puts 'Not all responses from the whitelist are covered!'
253
- exit 1
254
- end
255
- end
256
-
257
- desc 'Fitting tests'
258
- task :tests_responses, [:size] => :environment do |_, args|
259
- if args.size == 'xs'
260
- realized_unit = Fitting::Records::RealizedUnit.new(
261
- Fitting::Records::Spherical::Requests.new,
262
- Fitting.configuration.tomogram
263
- )
264
- puts Fitting::Templates::RealizedTemplate.new(realized_unit).to_s
265
-
266
- unless realized_unit.fully_covered?
267
- puts 'Not all responses from the whitelist are covered!'
268
- exit 1
269
- end
270
- else
271
- puts 'need key xs'
272
- end
273
90
  end
274
91
  end
@@ -0,0 +1,91 @@
1
+ require 'fitting/records/spherical/requests'
2
+ require 'fitting/cover/json_schema'
3
+ require 'fitting/report/prefixes'
4
+ require 'fitting/report/tests'
5
+ require 'fitting/report/console'
6
+
7
+ namespace :fitting_out do
8
+ task :report do
9
+ tests = Fitting::Report::Tests.new_from_outgoing_config
10
+ prefixes = Fitting::Report::Prefixes.new(Fitting.configuration.outgoing_prefixes)
11
+
12
+ prefixes.join(tests)
13
+
14
+ prefixes.to_a.map do |prefix|
15
+ prefix.actions.join(prefix.tests) unless prefix.skip?
16
+ end
17
+
18
+ prefixes.to_a.map do |prefix|
19
+ next if prefix.skip?
20
+
21
+ prefix.actions.to_a.map do |action|
22
+ action.responses.join(action.tests)
23
+ end
24
+ end
25
+
26
+ prefixes.to_a.map do |prefix|
27
+ next if prefix.skip?
28
+
29
+ prefix.actions.to_a.map do |action|
30
+ action.responses.to_a.map do |response|
31
+ response.combinations.join(response.tests)
32
+ end
33
+ end
34
+ end
35
+
36
+ report = JSON.pretty_generate(
37
+ {
38
+ tests_without_prefixes: tests.without_prefixes,
39
+ prefixes_details: prefixes.to_a.map(&:details)
40
+ }
41
+ )
42
+
43
+ destination = 'fitting'
44
+ FileUtils.mkdir_p(destination)
45
+ FileUtils.rm_r Dir.glob("#{destination}/*"), force: true
46
+ File.open('fitting/report.json', 'w') { |file| file.write(report) }
47
+
48
+ gem_path = $LOAD_PATH.find { |i| i.include?('fitting') }
49
+ source_path = "#{gem_path}/templates/bomboniere/dist"
50
+ FileUtils.copy_entry source_path, destination
51
+
52
+ json_schemas = {}
53
+ combinations = {}
54
+ prefixes.to_a.map do |prefix|
55
+ next if prefix.skip?
56
+
57
+ prefix.actions.to_a.map do |action|
58
+ action.responses.to_a.map do |response|
59
+ json_schemas[response.id] = response.body
60
+ response.combinations.to_a.map do |combination|
61
+ combinations.merge!(combination.id => combination.json_schema)
62
+ end
63
+ end
64
+ end
65
+ end
66
+ File.open('fitting/json_schemas.json', 'w') { |file| file.write(JSON.pretty_generate(json_schemas)) }
67
+ File.open('fitting/combinations.json', 'w') { |file| file.write(JSON.pretty_generate(combinations)) }
68
+ File.open('fitting/tests.json', 'w') { |file| file.write(JSON.pretty_generate(tests.to_h)) }
69
+
70
+ js_path = Dir["#{destination}/js/*"].find { |f| f[0..14] == 'fitting/js/app.' and f[-3..] == '.js' }
71
+ js_file = File.read(js_path)
72
+ new_js_file = js_file.gsub('{stub:"prefixes report"}', report)
73
+ new_js_file = new_js_file.gsub('{stub:"for action page"}', report)
74
+ new_js_file = new_js_file.gsub('{stub:"json-schemas"}', JSON.pretty_generate(json_schemas))
75
+ new_js_file = new_js_file.gsub('{stub:"combinations"}', JSON.pretty_generate(combinations))
76
+ new_js_file = new_js_file.gsub('{stub:"tests"}', JSON.pretty_generate(tests.to_h))
77
+ File.open(js_path, 'w') { |file| file.write(new_js_file) }
78
+
79
+ console = Fitting::Report::Console.new(
80
+ tests.without_prefixes,
81
+ prefixes.to_a.map(&:details)
82
+ )
83
+
84
+ puts console.output
85
+ puts console.output_sum
86
+
87
+ exit 1 unless console.good?
88
+
89
+ exit 0
90
+ end
91
+ end
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.18.2
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - d.efimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-09 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema
@@ -30,6 +30,26 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.6.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: terminal-table
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.0.2
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.0.2
33
53
  - !ruby/object:Gem::Dependency
34
54
  name: tomograph
35
55
  requirement: !ruby/object:Gem::Requirement
@@ -122,14 +142,14 @@ dependencies:
122
142
  name: rubocop
123
143
  requirement: !ruby/object:Gem::Requirement
124
144
  requirements:
125
- - - "~>"
145
+ - - ">="
126
146
  - !ruby/object:Gem::Version
127
147
  version: 1.22.0
128
148
  type: :development
129
149
  prerelease: false
130
150
  version_requirements: !ruby/object:Gem::Requirement
131
151
  requirements:
132
- - - "~>"
152
+ - - ">="
133
153
  - !ruby/object:Gem::Version
134
154
  version: 1.22.0
135
155
  - !ruby/object:Gem::Dependency
@@ -173,26 +193,16 @@ files:
173
193
  - images/logo.png
174
194
  - lib/fitting.rb
175
195
  - lib/fitting/configuration.rb
176
- - lib/fitting/configuration/yaml.rb
177
196
  - lib/fitting/cover/json_schema.rb
178
197
  - lib/fitting/cover/json_schema_enum.rb
179
198
  - lib/fitting/cover/json_schema_one_of.rb
180
- - lib/fitting/cover/response.rb
181
- - lib/fitting/documentation.rb
182
- - lib/fitting/matchers/response_matcher.rb
183
199
  - lib/fitting/railtie.rb
184
200
  - lib/fitting/records/documented/request.rb
185
- - lib/fitting/records/realized_unit.rb
186
201
  - lib/fitting/records/spherical/request.rb
187
202
  - lib/fitting/records/spherical/requests.rb
188
203
  - lib/fitting/records/spherical/response.rb
189
- - lib/fitting/records/test_unit/request.rb
190
204
  - lib/fitting/records/tested/request.rb
191
205
  - lib/fitting/records/tested/response.rb
192
- - lib/fitting/records/unit/combination.rb
193
- - lib/fitting/records/unit/json_schema.rb
194
- - lib/fitting/records/unit/request.rb
195
- - lib/fitting/records/unit/response.rb
196
206
  - lib/fitting/report/action.rb
197
207
  - lib/fitting/report/actions.rb
198
208
  - lib/fitting/report/combination.rb
@@ -204,37 +214,11 @@ files:
204
214
  - lib/fitting/report/responses.rb
205
215
  - lib/fitting/report/test.rb
206
216
  - lib/fitting/report/tests.rb
207
- - lib/fitting/request.rb
208
- - lib/fitting/response.rb
209
- - lib/fitting/response/fully_validates.rb
210
- - lib/fitting/statistics.rb
211
- - lib/fitting/statistics/analysis.rb
212
- - lib/fitting/statistics/cover_error.rb
213
- - lib/fitting/statistics/cover_error_enum.rb
214
- - lib/fitting/statistics/cover_error_one_of.rb
215
- - lib/fitting/statistics/great.rb
216
- - lib/fitting/statistics/list.rb
217
- - lib/fitting/statistics/lists.rb
218
- - lib/fitting/statistics/measurement.rb
219
- - lib/fitting/statistics/measurement_cover.rb
220
- - lib/fitting/statistics/measurement_cover_enum.rb
221
- - lib/fitting/statistics/measurement_cover_one_of.rb
222
- - lib/fitting/statistics/not_covered_responses.rb
223
- - lib/fitting/statistics/percent.rb
224
- - lib/fitting/statistics/requests_stats.rb
225
- - lib/fitting/statistics/responses_stats.rb
226
- - lib/fitting/statistics/template.rb
227
- - lib/fitting/statistics/template_cover_error.rb
228
- - lib/fitting/statistics/template_cover_error_enum.rb
229
- - lib/fitting/statistics/template_cover_error_one_of.rb
230
217
  - lib/fitting/storage/responses.rb
231
- - lib/fitting/storage/white_list.rb
232
- - lib/fitting/templates/realized_template.rb
233
218
  - lib/fitting/tests.rb
234
219
  - lib/fitting/version.rb
235
- - lib/fitting/view/report.html.haml
236
- - lib/fitting/view/style.css
237
220
  - lib/tasks/fitting.rake
221
+ - lib/tasks/fitting_outgoing.rake
238
222
  - lib/templates/bomboniere/.gitignore
239
223
  - lib/templates/bomboniere/.tool-versions
240
224
  - lib/templates/bomboniere/README.md
@@ -1,89 +0,0 @@
1
- require 'tomograph'
2
-
3
- module Fitting
4
- class Configuration
5
- class Yaml
6
- attr_reader :title
7
- attr_accessor :apib_path,
8
- :drafter_yaml_path,
9
- :crafter_apib_path,
10
- :crafter_yaml_path,
11
- :drafter_4_apib_path,
12
- :drafter_4_yaml_path,
13
- :tomogram_json_path,
14
- :strict,
15
- :prefix,
16
- :white_list,
17
- :resource_white_list,
18
- :ignore_list,
19
- :include_resources,
20
- :include_actions
21
-
22
- def initialize(yaml, title = 'fitting')
23
- @apib_path = yaml['apib_path']
24
- @drafter_yaml_path = yaml['drafter_yaml_path']
25
- @crafter_apib_path = yaml['crafter_apib_path']
26
- @crafter_yaml_path = yaml['crafter_yaml_path']
27
- @drafter_4_apib_path = yaml['drafter_4_apib_path']
28
- @drafter_4_yaml_path = yaml['drafter_4_yaml_path']
29
- @tomogram_json_path = yaml['tomogram_json_path']
30
- @strict = yaml['strict']
31
- @prefix = yaml['prefix']
32
- @white_list = yaml['white_list']
33
- @resource_white_list = yaml['resource_white_list']
34
- @ignore_list = yaml['ignore_list']
35
- @include_resources = yaml['include_resources']
36
- @include_actions = yaml['include_actions']
37
- @title = title
38
- default
39
- end
40
-
41
- def tomogram
42
- @tomogram ||= if crafter_yaml_path || crafter_apib_path
43
- Tomograph::Tomogram.new(
44
- prefix: prefix,
45
- crafter_apib_path: crafter_apib_path,
46
- crafter_yaml_path: crafter_yaml_path
47
- )
48
- elsif drafter_4_apib_path || drafter_4_yaml_path
49
- Tomograph::Tomogram.new(
50
- prefix: prefix,
51
- drafter_4_apib_path: drafter_4_apib_path,
52
- drafter_4_yaml_path: drafter_4_yaml_path
53
- )
54
- else
55
- Tomograph::Tomogram.new(
56
- prefix: prefix,
57
- apib_path: apib_path,
58
- drafter_yaml_path: drafter_yaml_path,
59
- tomogram_json_path: tomogram_json_path
60
- )
61
- end
62
- end
63
-
64
- def stats_path
65
- if @title == 'fitting'
66
- 'fitting/stats'
67
- else
68
- "fitting/#{@title}/stats"
69
- end
70
- end
71
-
72
- def not_covered_path
73
- if @title == 'fitting'
74
- 'fitting/not_covered'
75
- else
76
- "fitting/#{@title}/not_covered"
77
- end
78
- end
79
-
80
- private
81
-
82
- def default
83
- @strict ||= false if strict.nil?
84
- @prefix ||= ''
85
- @ignore_list ||= []
86
- end
87
- end
88
- end
89
- end