fitting 2.17.0 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +31 -3
  3. data/CHANGELOG.md +5 -0
  4. data/fitting.gemspec +7 -7
  5. data/lib/fitting/configuration/legacy.rb +6 -5
  6. data/lib/fitting/configuration/yaml.rb +2 -2
  7. data/lib/fitting/cover/json_schema.rb +3 -2
  8. data/lib/fitting/cover/json_schema_enum.rb +1 -1
  9. data/lib/fitting/cover/json_schema_one_of.rb +1 -1
  10. data/lib/fitting/cover/response.rb +1 -5
  11. data/lib/fitting/documentation.rb +0 -2
  12. data/lib/fitting/matchers/response_matcher.rb +2 -1
  13. data/lib/fitting/records/documented/request.rb +1 -0
  14. data/lib/fitting/records/realized_unit.rb +13 -15
  15. data/lib/fitting/records/spherical/request.rb +1 -1
  16. data/lib/fitting/records/spherical/requests.rb +2 -1
  17. data/lib/fitting/records/spherical/response.rb +2 -2
  18. data/lib/fitting/records/test_unit/request.rb +4 -0
  19. data/lib/fitting/records/tested/request.rb +1 -1
  20. data/lib/fitting/records/unit/combination.rb +5 -6
  21. data/lib/fitting/records/unit/json_schema.rb +38 -33
  22. data/lib/fitting/records/unit/request.rb +1 -0
  23. data/lib/fitting/records/unit/response.rb +1 -0
  24. data/lib/fitting/report/action.rb +6 -9
  25. data/lib/fitting/report/actions.rb +7 -5
  26. data/lib/fitting/report/combination.rb +1 -15
  27. data/lib/fitting/report/combinations.rb +5 -6
  28. data/lib/fitting/report/console.rb +4 -3
  29. data/lib/fitting/report/prefix.rb +42 -51
  30. data/lib/fitting/report/prefixes.rb +3 -3
  31. data/lib/fitting/report/response.rb +17 -18
  32. data/lib/fitting/report/responses.rb +9 -8
  33. data/lib/fitting/report/test.rb +9 -11
  34. data/lib/fitting/report/tests.rb +10 -13
  35. data/lib/fitting/request.rb +0 -1
  36. data/lib/fitting/response.rb +4 -3
  37. data/lib/fitting/statistics/cover_error.rb +2 -0
  38. data/lib/fitting/statistics/cover_error_enum.rb +2 -0
  39. data/lib/fitting/statistics/cover_error_one_of.rb +2 -0
  40. data/lib/fitting/statistics/list.rb +5 -4
  41. data/lib/fitting/statistics/not_covered_responses.rb +1 -1
  42. data/lib/fitting/statistics/percent.rb +2 -1
  43. data/lib/fitting/statistics/template.rb +10 -8
  44. data/lib/fitting/storage/white_list.rb +7 -0
  45. data/lib/fitting/templates/realized_template.rb +2 -0
  46. data/lib/fitting/tests.rb +1 -1
  47. data/lib/fitting/version.rb +1 -1
  48. data/lib/fitting.rb +5 -2
  49. data/lib/tasks/fitting.rake +62 -54
  50. metadata +17 -49
@@ -3,79 +3,70 @@ require 'fitting/report/actions'
3
3
  module Fitting
4
4
  module Report
5
5
  class Prefix
6
- def initialize(name: '', openapi2_json_path: nil, openapi3_yaml_path: nil, drafter_yaml_path: nil, tomogram_json_path: nil, crafter_yaml_path: nil, skip: false)
6
+ def initialize(name: '', openapi2_json_path: nil, openapi3_yaml_path: nil,
7
+ drafter_yaml_path: nil, tomogram_json_path: nil, crafter_yaml_path: nil, skip: false)
7
8
  @name = name
8
9
  @tomogram_json_path = tomogram_json_path
9
10
  @tests = Fitting::Report::Tests.new([])
10
11
  @skip = skip
11
- unless skip
12
- @actions = if openapi2_json_path
13
- Fitting::Report::Actions.new(
14
- Tomograph::Tomogram.new(
15
- prefix: name,
16
- openapi2_json_path: openapi2_json_path
17
- )
12
+ return if skip
13
+
14
+ @actions = if openapi2_json_path
15
+ Fitting::Report::Actions.new(
16
+ Tomograph::Tomogram.new(
17
+ prefix: name,
18
+ openapi2_json_path: openapi2_json_path
18
19
  )
19
- elsif openapi3_yaml_path
20
- Fitting::Report::Actions.new(
21
- Tomograph::Tomogram.new(
22
- prefix: name,
23
- openapi3_yaml_path: openapi3_yaml_path
24
- )
20
+ )
21
+ elsif openapi3_yaml_path
22
+ Fitting::Report::Actions.new(
23
+ Tomograph::Tomogram.new(
24
+ prefix: name,
25
+ openapi3_yaml_path: openapi3_yaml_path
25
26
  )
26
- elsif drafter_yaml_path
27
- Fitting::Report::Actions.new(
28
- Tomograph::Tomogram.new(
29
- prefix: name,
30
- drafter_yaml_path: drafter_yaml_path
31
- )
27
+ )
28
+ elsif drafter_yaml_path
29
+ Fitting::Report::Actions.new(
30
+ Tomograph::Tomogram.new(
31
+ prefix: name,
32
+ drafter_yaml_path: drafter_yaml_path
32
33
  )
33
- elsif crafter_yaml_path
34
- Fitting::Report::Actions.new(
35
- Tomograph::Tomogram.new(
36
- prefix: name,
37
- crafter_yaml_path: crafter_yaml_path
38
- )
34
+ )
35
+ elsif crafter_yaml_path
36
+ Fitting::Report::Actions.new(
37
+ Tomograph::Tomogram.new(
38
+ prefix: name,
39
+ crafter_yaml_path: crafter_yaml_path
39
40
  )
40
- else
41
- Fitting::Report::Actions.new(
42
- Tomograph::Tomogram.new(
43
- prefix: name,
44
- tomogram_json_path: tomogram_json_path
45
- )
41
+ )
42
+ else
43
+ Fitting::Report::Actions.new(
44
+ Tomograph::Tomogram.new(
45
+ prefix: name,
46
+ tomogram_json_path: tomogram_json_path
46
47
  )
47
- end
48
- end
48
+ )
49
+ end
49
50
  end
50
51
 
51
- def name
52
- @name
53
- end
54
-
55
- def tests
56
- @tests
57
- end
52
+ attr_reader :name, :tests, :actions
58
53
 
59
54
  def skip?
60
55
  @skip
61
56
  end
62
57
 
63
- def actions
64
- @actions
65
- end
66
-
67
58
  def details
68
59
  if @skip
69
60
  {
70
- name: @name,
71
- tests_size: @tests.size,
72
- actions: {tests_without_actions: [], actions_details: []}
61
+ name: @name,
62
+ tests_size: @tests.size,
63
+ actions: { tests_without_actions: [], actions_details: [] }
73
64
  }
74
65
  else
75
66
  {
76
- name: @name,
77
- tests_size: @tests.size,
78
- actions: @actions.details(self)
67
+ name: @name,
68
+ tests_size: @tests.size,
69
+ actions: @actions.details(self)
79
70
  }
80
71
  end
81
72
  end
@@ -20,7 +20,7 @@ module Fitting
20
20
  end
21
21
  end
22
22
 
23
- def is_there_a_suitable_prefix?(test_path)
23
+ def there_a_suitable_prefix?(test_path)
24
24
  @prefixes.map do |prefix|
25
25
  return true if prefix.name.nil?
26
26
  return true if prefix.name == ''
@@ -34,14 +34,14 @@ module Fitting
34
34
  @prefixes.map do |prefix|
35
35
  if prefix.name.nil? || prefix.name == '' || test.path[0..prefix.name.size - 1] == prefix.name
36
36
  prefix.add_test(test)
37
- return
37
+ break
38
38
  end
39
39
  end
40
40
  end
41
41
 
42
42
  def join(tests)
43
43
  tests.to_a.map do |test|
44
- if is_there_a_suitable_prefix?(test.path)
44
+ if there_a_suitable_prefix?(test.path)
45
45
  cram_into_the_appropriate_prefix(test)
46
46
  test.mark_prefix
47
47
  end
@@ -21,31 +21,27 @@ module Fitting
21
21
  @response['body'] || @response[:body]
22
22
  end
23
23
 
24
- def id
25
- @id
26
- end
24
+ attr_reader :id, :tests
27
25
 
28
26
  def add_test(test)
29
27
  @tests.push(test)
30
28
  end
31
29
 
32
- def tests
33
- @tests
34
- end
35
-
36
30
  def combinations
37
31
  return @combinations if @combinations
38
32
 
39
33
  cmbntns = []
40
- combinations = Fitting::Cover::JSONSchema.new(body).combi + Fitting::Cover::JSONSchemaEnum.new(body).combi + Fitting::Cover::JSONSchemaOneOf.new(body).combi
34
+ combinations = Fitting::Cover::JSONSchema.new(body).combi +
35
+ Fitting::Cover::JSONSchemaEnum.new(body).combi +
36
+ Fitting::Cover::JSONSchemaOneOf.new(body).combi
41
37
  if combinations != []
42
38
  combinations.map do |combination|
43
39
  cmbntns.push(
44
- Fitting::Report::Combination.new(
45
- json_schema: combination[0],
46
- type: combination[1][0],
47
- combination: combination[1][1]
48
- )
40
+ Fitting::Report::Combination.new(
41
+ json_schema: combination[0],
42
+ type: combination[1][0],
43
+ combination: combination[1][1]
44
+ )
49
45
  )
50
46
  end
51
47
  end
@@ -54,16 +50,19 @@ module Fitting
54
50
  end
55
51
 
56
52
  def cover_percent
57
- return '0%' if @tests.size == 0
58
- return '100%' if @combinations.size == 0
53
+ return '0%' if @tests.size.zero?
54
+ return '100%' if @combinations.size.zero?
55
+
59
56
  "#{(@combinations.size_with_tests + 1) * 100 / (@combinations.size + 1)}%"
60
57
  end
61
58
 
62
59
  def details
63
60
  {
64
- cover_percent: cover_percent,
65
- tests_without_combinations: @tests.without_combinations,
66
- combinations_details: @combinations.to_a.map { |c| {json_schema: c.id, tests_size: c.tests.size, type: c.type, name: c.name} }
61
+ cover_percent: cover_percent,
62
+ tests_without_combinations: @tests.without_combinations,
63
+ combinations_details: @combinations.to_a.map do |c|
64
+ { json_schema: c.id, tests_size: c.tests.size, type: c.type, name: c.name }
65
+ end
67
66
  }
68
67
  end
69
68
  end
@@ -17,18 +17,19 @@ module Fitting
17
17
 
18
18
  def join(tests)
19
19
  tests.to_a.map do |test|
20
- if is_there_a_suitable_response?(test)
20
+ if there_a_suitable_response?(test)
21
21
  cram_into_the_appropriate_response(test)
22
22
  test.mark_response
23
23
  end
24
24
  end
25
25
  end
26
26
 
27
- def is_there_a_suitable_response?(test)
27
+ def there_a_suitable_response?(test)
28
28
  return false if @responses.nil?
29
+
29
30
  @responses.map do |response|
30
31
  return true if response.status.to_s == test.status &&
31
- JSON::Validator.fully_validate(response.body, test.body) == []
32
+ JSON::Validator.fully_validate(response.body, test.body) == []
32
33
  end
33
34
 
34
35
  false
@@ -36,11 +37,11 @@ module Fitting
36
37
 
37
38
  def cram_into_the_appropriate_response(test)
38
39
  @responses.map do |response|
39
- if response.status.to_s == test.status &&
40
- JSON::Validator.fully_validate(response.body, test.body) == []
41
- response.add_test(test)
42
- return
43
- end
40
+ next unless response.status.to_s == test.status &&
41
+ JSON::Validator.fully_validate(response.body, test.body) == []
42
+
43
+ response.add_test(test)
44
+ break
44
45
  end
45
46
  end
46
47
  end
@@ -10,16 +10,14 @@ module Fitting
10
10
  @id = SecureRandom.hex
11
11
  end
12
12
 
13
- def id
14
- @id
15
- end
13
+ attr_reader :id
16
14
 
17
15
  def to_h
18
16
  {
19
- path: path,
20
- method: method,
21
- status: status,
22
- body: body
17
+ path: path,
18
+ method: method,
19
+ status: status,
20
+ body: body
23
21
  }
24
22
  end
25
23
 
@@ -55,19 +53,19 @@ module Fitting
55
53
  @combination = true
56
54
  end
57
55
 
58
- def is_there_a_prefix?
56
+ def there_a_prefix?
59
57
  @prefix
60
58
  end
61
59
 
62
- def is_there_an_actions?
60
+ def there_an_actions?
63
61
  @action
64
62
  end
65
63
 
66
- def is_there_an_responses?
64
+ def there_an_responses?
67
65
  @response
68
66
  end
69
67
 
70
- def is_there_an_combinations?
68
+ def there_an_combinations?
71
69
  @combination
72
70
  end
73
71
  end
@@ -10,7 +10,7 @@ module Fitting
10
10
  def self.new_from_config(tests_path)
11
11
  tests = []
12
12
  Dir[tests_path].each do |file|
13
- JSON.load(File.read(file)).map do |test|
13
+ JSON.parse(File.read(file)).map do |test|
14
14
  tests.push(Fitting::Report::Test.new(test))
15
15
  end
16
16
  end
@@ -19,30 +19,26 @@ module Fitting
19
19
  end
20
20
 
21
21
  def without_prefixes
22
- @tests.inject([]) do |result, test|
23
- result.push(test.path) unless test.is_there_a_prefix?
24
- result
22
+ @tests.each_with_object([]) do |test, result|
23
+ result.push(test.path) unless test.there_a_prefix?
25
24
  end
26
25
  end
27
26
 
28
27
  def without_actions
29
- @tests.inject([]) do |result, test|
30
- result.push("#{test.method} #{test.path}") unless test.is_there_an_actions?
31
- result
28
+ @tests.each_with_object([]) do |test, result|
29
+ result.push("#{test.method} #{test.path}") unless test.there_an_actions?
32
30
  end
33
31
  end
34
32
 
35
33
  def without_responses
36
- @tests.inject([]) do |result, test|
37
- result.push(test.id) unless test.is_there_an_responses?
38
- result
34
+ @tests.each_with_object([]) do |test, result|
35
+ result.push(test.id) unless test.there_an_responses?
39
36
  end
40
37
  end
41
38
 
42
39
  def without_combinations
43
- @tests.inject([]) do |result, test|
44
- result.push(test.path) unless test.is_there_an_combinations?
45
- result
40
+ @tests.each_with_object([]) do |test, result|
41
+ result.push(test.path) unless test.there_an_combinations?
46
42
  end
47
43
  end
48
44
 
@@ -60,6 +56,7 @@ module Fitting
60
56
 
61
57
  def to_h
62
58
  return @hash if @hash
59
+
63
60
  @hash = @tests.inject({}) do |res, test|
64
61
  res.merge!(test.id => test.to_h)
65
62
  end
@@ -7,7 +7,6 @@ module Fitting
7
7
  @path = env_request.env['PATH_INFO'] || env_request.fullpath
8
8
  @body = env_request.env['action_dispatch.request.request_parameters']
9
9
  @schema = tomogram.find_request(method: @method, path: @path)
10
- self
11
10
  end
12
11
 
13
12
  def route
@@ -1,7 +1,6 @@
1
1
  require 'fitting/request'
2
2
  require 'fitting/response/fully_validates'
3
3
  require 'json'
4
- require 'multi_json'
5
4
 
6
5
  module Fitting
7
6
  class Response
@@ -27,7 +26,7 @@ module Fitting
27
26
  end
28
27
 
29
28
  def documented?
30
- @schemas && @schemas.present?
29
+ @schemas&.present?
31
30
  end
32
31
 
33
32
  def route
@@ -47,7 +46,7 @@ module Fitting
47
46
  end
48
47
 
49
48
  def got
50
- JSON.pretty_generate(MultiJson.load(@body))
49
+ JSON.pretty_generate(JSON.parse(@body))
51
50
  end
52
51
 
53
52
  def expected
@@ -68,6 +67,7 @@ module Fitting
68
67
 
69
68
  def index
70
69
  return @index_res if @index_res
70
+
71
71
  @index_res = []
72
72
  @schemas.size.times do |i|
73
73
  @index_res.push(i) if fully_validates[i] == []
@@ -77,6 +77,7 @@ module Fitting
77
77
 
78
78
  def strict_index
79
79
  return @strict_index_res if @strict_index_res
80
+
80
81
  @strict_index_res = []
81
82
  @schemas.size.times do |i|
82
83
  @strict_index_res.push(i) if strict_fully_validates[i] == []
@@ -10,9 +10,11 @@ module Fitting
10
10
  @request_unit.map do |request|
11
11
  request.responses.map do |response|
12
12
  next unless response.tested_bodies != []
13
+
13
14
  response.json_schemas.map do |json_schema|
14
15
  json_schema.combinations.map do |combination|
15
16
  next unless combination.valid_bodies == []
17
+
16
18
  res += "request method: #{request.method}\nrequest path: #{request.path}\n"\
17
19
  "response status: #{response.status}\nsource json-schema: #{json_schema.json_schema}\n"\
18
20
  "combination: #{combination.description}\nnew json-schema: #{combination.json_schema}\n\n"
@@ -10,9 +10,11 @@ module Fitting
10
10
  @request_unit.map do |request|
11
11
  request.responses.map do |response|
12
12
  next unless response.tested_bodies != []
13
+
13
14
  response.json_schemas.map do |json_schema|
14
15
  json_schema.combinations_with_enum.map do |combination|
15
16
  next unless combination.valid_bodies == []
17
+
16
18
  res += "request method: #{request.method}\nrequest path: #{request.path}\n"\
17
19
  "response status: #{response.status}\nsource json-schema: #{json_schema.json_schema}\n"\
18
20
  "combination: #{combination.description}\nnew json-schema: #{combination.json_schema}\n\n"
@@ -10,9 +10,11 @@ module Fitting
10
10
  @request_unit.map do |request|
11
11
  request.responses.map do |response|
12
12
  next unless response.tested_bodies != []
13
+
13
14
  response.json_schemas.map do |json_schema|
14
15
  json_schema.combinations_with_one_of.map do |combination|
15
16
  next unless combination.valid_bodies == []
17
+
16
18
  res += "request method: #{request.method}\nrequest path: #{request.path}\n"\
17
19
  "response status: #{response.status}\nsource json-schema: #{json_schema.json_schema}\n"\
18
20
  "combination: #{combination.description}\nnew json-schema: #{combination.json_schema}\n\n"
@@ -35,17 +35,18 @@ module Fitting
35
35
  end
36
36
 
37
37
  def json_schema_stat(res, json_schema, response)
38
- if @depth == 'valid'
38
+ case @depth
39
+ when 'valid'
39
40
  if json_schema.bodies == []
40
41
  res.push("✖ #{response.status}")
41
42
  else
42
43
  res.push("✔ #{response.status}")
43
44
  end
44
- elsif @depth == 'cover'
45
+ when 'cover'
45
46
  res.push("#{json_schema.cover}% #{response.status}")
46
- elsif @depth == 'cover_enum'
47
+ when 'cover_enum'
47
48
  res.push("#{json_schema.cover_enum}% #{response.status}")
48
- elsif @depth == 'cover_one_of'
49
+ when 'cover_one_of'
49
50
  res.push("#{json_schema.cover_one_of}% #{response.status}")
50
51
  end
51
52
  end
@@ -6,7 +6,7 @@ module Fitting
6
6
  end
7
7
 
8
8
  def to_s
9
- @measurement.not_covered_responses.join("\n") + "\n"
9
+ "#{@measurement.not_covered_responses.join("\n")}\n"
10
10
  end
11
11
  end
12
12
  end
@@ -8,7 +8,8 @@ module Fitting
8
8
 
9
9
  def to_f
10
10
  return 0.to_f if @divider.zero?
11
- (@dividend.to_f / @divider.to_f * 100.0).round(2)
11
+
12
+ (@dividend.to_f / @divider * 100.0).round(2)
12
13
  end
13
14
 
14
15
  def to_s
@@ -48,26 +48,28 @@ module Fitting
48
48
 
49
49
  def white_measurement
50
50
  @white_measurement ||=
51
- if @depth == 'valid'
51
+ case @depth
52
+ when 'valid'
52
53
  Fitting::Statistics::Measurement.new(white_unit)
53
- elsif @depth == 'cover'
54
+ when 'cover'
54
55
  Fitting::Statistics::MeasurementCover.new(white_unit)
55
- elsif @depth == 'cover_enum'
56
+ when 'cover_enum'
56
57
  Fitting::Statistics::MeasurementCoverEnum.new(white_unit)
57
- elsif @depth == 'cover_one_of'
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
- if @depth == 'valid'
65
+ case @depth
66
+ when 'valid'
65
67
  Fitting::Statistics::Measurement.new(black_unit)
66
- elsif @depth == 'cover'
68
+ when 'cover'
67
69
  Fitting::Statistics::MeasurementCover.new(black_unit)
68
- elsif @depth == 'cover_enum'
70
+ when 'cover_enum'
69
71
  Fitting::Statistics::MeasurementCoverEnum.new(black_unit)
70
- elsif @depth == 'cover_one_of'
72
+ when 'cover_one_of'
71
73
  Fitting::Statistics::MeasurementCoverOneOf.new(black_unit)
72
74
  end
73
75
  end
@@ -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["TEST_ENV_NUMBER"]}.json", 'w') { |file| file.write(json) }
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)
@@ -1,3 +1,3 @@
1
1
  module Fitting
2
- VERSION = '2.17.0'.freeze
2
+ VERSION = '2.18.0'.freeze
3
3
  end
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,10 +29,13 @@ 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("fitting_tests/*"), :force => true
38
+ FileUtils.rm_r Dir.glob('fitting_tests/*'), force: true
37
39
 
38
40
  RSpec.configure do |config|
39
41
  config.after(:each, type: :request) 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|