fitting 2.9.0 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/fitting.gemspec +0 -1
- data/lib/fitting/version.rb +1 -1
- metadata +1 -16
- data/lib/fitting/cover.rb +0 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3434f295129747bcf09ef0086f4db92f9841ab56
|
4
|
+
data.tar.gz: 958efdb10898402d6eb47fa3f36a0b03ee815ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cca66c6af2f3b323000c1eccfaadbf5d67685088a922869dd84ae51c7af847c5edb85e4d60a07336c3ee434779b2e05710d07bb8c2a4c93cb9f75652096cd26
|
7
|
+
data.tar.gz: 32eaec26bf1bb70eb6b2029fcace976c99a51a671b9939914ab0286b2fbdd5343a4fbc397a247c45ebd4b26bfeeb0ad774084dd15864dfa93ac7c97a19ad2dd6
|
data/CHANGELOG.md
CHANGED
data/fitting.gemspec
CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'haml', '~> 1'
|
22
21
|
spec.add_runtime_dependency 'json-schema', '~> 2.6', '>= 2.6.2'
|
23
22
|
spec.add_runtime_dependency 'multi_json', '~> 1.11'
|
24
23
|
spec.add_runtime_dependency 'tomograph', '~> 2.0', '>= 2.2.0'
|
data/lib/fitting/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fitting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- d.efimov
|
@@ -10,20 +10,6 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: haml
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: json-schema
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,7 +196,6 @@ files:
|
|
210
196
|
- lib/fitting/configuration.rb
|
211
197
|
- lib/fitting/configuration/legacy.rb
|
212
198
|
- lib/fitting/configuration/yaml.rb
|
213
|
-
- lib/fitting/cover.rb
|
214
199
|
- lib/fitting/cover/json_schema.rb
|
215
200
|
- lib/fitting/cover/json_schema_enum.rb
|
216
201
|
- lib/fitting/cover/response.rb
|
data/lib/fitting/cover.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'fitting/cover/response'
|
2
|
-
require 'haml'
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
module Fitting
|
6
|
-
class Cover
|
7
|
-
def initialize(all_responses, coverage)
|
8
|
-
@all_responses = all_responses
|
9
|
-
@coverage = coverage
|
10
|
-
@list = {}
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_hash
|
14
|
-
return @list unless @list == {}
|
15
|
-
@all_responses.each_with_object({}) do |response, res|
|
16
|
-
next res unless response.documented?
|
17
|
-
if res.key?(response.route)
|
18
|
-
res[response.route].update(response)
|
19
|
-
else
|
20
|
-
res[response.route] = Fitting::Cover::Response.new(response)
|
21
|
-
end
|
22
|
-
end.map do |key, value|
|
23
|
-
@list[key] = value.to_hash
|
24
|
-
end
|
25
|
-
@list
|
26
|
-
end
|
27
|
-
|
28
|
-
def template
|
29
|
-
return @template if @template
|
30
|
-
@template = {}
|
31
|
-
to_hash.each do |key, value|
|
32
|
-
@template[key] = value
|
33
|
-
@template[key]['cover'] = 100.0
|
34
|
-
if value['flags'] == []
|
35
|
-
@template[key]['type'] = 'passed'
|
36
|
-
else
|
37
|
-
flag_true = value['flags'].find_all { |flag| flag == true }
|
38
|
-
flag_false = value['flags'].find_all { |flag| flag == false }
|
39
|
-
if flag_false.empty?
|
40
|
-
@template[key]['type'] = 'passed'
|
41
|
-
else
|
42
|
-
@template[key]['cover'] = if flag_true.empty?
|
43
|
-
0.0
|
44
|
-
else
|
45
|
-
flag_false.size / flag_true.size
|
46
|
-
end
|
47
|
-
@template[key]['type'] = 'failed'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
@template[key]['json_schema'] = JSON.pretty_generate(value['json_schemas'].last)
|
51
|
-
end
|
52
|
-
@template
|
53
|
-
end
|
54
|
-
|
55
|
-
def save
|
56
|
-
to_hash
|
57
|
-
contents = File.read(File.expand_path('../view/report.html.haml', __FILE__))
|
58
|
-
html = "<style>\n#{File.read(File.expand_path('../view/style.css', __FILE__))}\n</style>\n"
|
59
|
-
html += Haml::Engine.new(contents).render(
|
60
|
-
Object.new,
|
61
|
-
:@to_hash => template
|
62
|
-
)
|
63
|
-
html
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|