fitting 2.18.2 → 2.18.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4939d5e53f11ac3b5f28fa3088b20acefd5613b3c7ea8b075917ce9fa5703acd
4
- data.tar.gz: 694aadc94e89341395c72cf1f26baeb065f7e10f6d0a7e305f4190ddc3e50d22
3
+ metadata.gz: 140967f23d0706212f16a4239f33e409fbb0430e7e7295850501426992909eed
4
+ data.tar.gz: 1178f1070ea69b6a1ed9e76cb7904c11a23e6d41652eba2fa587353c0e1cb6ef
5
5
  SHA512:
6
- metadata.gz: bd7f9bfe0f22b4110e304e80daf8f843d6eba3bdf32598767b6da1e294ff83867593402eaaaa9665649162789aa3485f64ee3af066688dec0af0e96edb52caf8
7
- data.tar.gz: 4ebe7ebf8d3f629b66f0378016fbd99a42d9d9907e911fe754732cb0c25761ebfe16cb095b4b76d11f24261b1f5213a6800e433998f225fd20b6bf9d7c0974e6
6
+ metadata.gz: 7649a6fa86471ab46d38e67ec1ae9bd30141802a8169f966558db9fadd1db22fc904c2ff185870937831e93411aaf81fb44dffd16a9f87ac7e71c3cc40108c2b
7
+ data.tar.gz: 9787db0e0c9bbd3f2f3b23fc0d10996642774838f41d974f3f90421b69a5d425c663d9675915a4275031d371f462aeeb799c71e2b819c2abe82df7faa1f2d1a9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ### 2.18.3 - 2021-11-12
4
+
5
+ * patch
6
+ * added print table console [#121](https://github.com/funbox/fitting/issues/121)
7
+
3
8
  ### 2.18.2 - 2021-11-09
4
9
 
5
10
  * patch
data/fitting.gemspec CHANGED
@@ -20,7 +20,9 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '>= 2.6.0'
22
22
  spec.add_runtime_dependency 'json-schema', '~> 2.6', '>= 2.6.2'
23
+ spec.add_runtime_dependency 'terminal-table', '~> 3.0', '>= 3.0.2'
23
24
  spec.add_runtime_dependency 'tomograph', '~> 3.1', '>= 3.1.0'
25
+
24
26
  spec.add_development_dependency 'bundler', '~> 2.0'
25
27
  spec.add_development_dependency 'byebug', '~> 11.1', '>= 11.1.3'
26
28
  spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
@@ -1,30 +1,50 @@
1
+ require 'terminal-table'
2
+
1
3
  module Fitting
2
4
  module Report
3
5
  class Console
4
6
  def initialize(tests_without_prefixes, prefixes_details)
5
7
  @tests_without_prefixes = tests_without_prefixes
6
8
  @prefixes_details = prefixes_details
9
+
7
10
  @good = true
8
11
  @tests_without_actions = []
9
12
  @tests_without_responses = []
10
13
  end
11
14
 
12
15
  def output
13
- doc_res = @prefixes_details.inject('') do |res, prefix_details|
14
- res += "#{prefix_details[:name]}\n"
15
- @tests_without_actions += prefix_details[:actions][:tests_without_actions]
16
- res += prefix_details[:actions][:actions_details].inject('') do |res_actions, action|
17
- res_actions += "#{action[:method]}\t#{action[:path]}"
18
- tab = "\t" * (8 - action[:path].size / 8)
19
- @tests_without_responses += action[:responses][:tests_without_responses]
20
- res_actions += tab + action[:responses][:responses_details].inject('') do |res_responses, response|
21
- @good = false if response[:combinations][:cover_percent] != '100%'
22
- res_responses += " #{response[:combinations][:cover_percent]} #{response[:method]}"
16
+ tables = []
17
+
18
+ @prefixes_details.each do |prefix_details|
19
+ title = prefix_details[:name]
20
+ @tests_without_actions += prefix_details[:actions][:tests_without_actions] # непонятно что такое
21
+
22
+ next if prefix_details[:actions][:actions_details].count.zero?
23
+
24
+ tables << Terminal::Table.new do |t|
25
+ t.title = title
26
+ t.headings = %w[method path cover]
27
+
28
+ prefix_details[:actions][:actions_details].each do |action|
29
+ @tests_without_responses += action[:responses][:tests_without_responses]
30
+
31
+ path_details = action[:responses][:responses_details].map do |responses_detail|
32
+ @good = false if responses_detail[:combinations][:cover_percent] != '100%'
33
+ [responses_detail[:combinations][:cover_percent], responses_detail[:method]]
34
+ end.join(' ')
35
+
36
+ t.add_row [action[:method], action[:path], path_details]
23
37
  end
24
- res_actions += "\n"
38
+
39
+ t.style = { all_separators: true, border: :unicode }
25
40
  end
26
41
  end
27
- doc_res += "\n"
42
+
43
+ tables
44
+ end
45
+
46
+ def output_sum
47
+ doc_res = ''
28
48
  doc_res += "tests_without_prefixes: #{@tests_without_prefixes.size}\n"
29
49
  doc_res += "tests_without_actions: #{@tests_without_actions.size}\n"
30
50
  doc_res += "tests_without_responses: #{@tests_without_responses.size}\n"
@@ -1,3 +1,3 @@
1
1
  module Fitting
2
- VERSION = '2.18.2'.freeze
2
+ VERSION = '2.18.3'.freeze
3
3
  end
@@ -88,6 +88,7 @@ namespace :fitting do
88
88
  )
89
89
 
90
90
  puts console.output
91
+ puts console.output_sum
91
92
 
92
93
  exit 1 unless console.good?
93
94
 
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: 2.18.3
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: 2021-11-12 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