stable 1.11.0 → 1.12.0
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/lib/stable/fact.rb +0 -68
- data/lib/stable/formatters/colors.rb +24 -0
- data/lib/stable/formatters/verbose.rb +84 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84ffc96e3befd0fb806003874c7b63dcc466b0c93de4c0490742542d0c22b98e
|
4
|
+
data.tar.gz: f7ed6f16c45d94a71f5042c91819617694d0ecb0a229dd15efe62c6b34463e59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 347c9d97b2e4f4a320bc43e62674de74b2c60e0001b5d05df852347d8307cd3be93332bbcb2c8b921ec60ebc51970f9e5cf180d8e92e4a14626d0b7c65d4493a
|
7
|
+
data.tar.gz: 4f9cb7f894efd116ce22dc200c11d5f2a1401cdadbbb4d9cc131961c4a612964196379c761db9d37f071cb5a682ece70a0cc983d30d46a8b495b61e782e56c6f
|
data/lib/stable/fact.rb
CHANGED
@@ -51,42 +51,7 @@ module Stable
|
|
51
51
|
self
|
52
52
|
end
|
53
53
|
|
54
|
-
def to_s
|
55
|
-
short_uuid = uuid.split('-').last
|
56
|
-
short_sig = signature[0..6]
|
57
|
-
desc = "#{short_uuid}/#{short_sig}"
|
58
|
-
name_str = name[..19].ljust(20)
|
59
|
-
call = "#{class_name}##{method_name}(#{args.join(', ')})"
|
60
|
-
status_code = _status_code
|
61
|
-
error_code = _error_code
|
62
54
|
|
63
|
-
case status
|
64
|
-
when :passed, :passed_with_error
|
65
|
-
"#{desc} #{name_str} #{status_code}#{error_code} #{call}"
|
66
|
-
when :failed
|
67
|
-
lines = ["#{desc} #{name_str} #{status_code}#{error_code} #{call}"]
|
68
|
-
if actual_error
|
69
|
-
if error
|
70
|
-
lines << " Expected error: #{error['class']}"
|
71
|
-
lines << " Actual error: #{actual_error.class.name}: #{actual_error.message}"
|
72
|
-
else
|
73
|
-
lines << " Expected result: #{result.inspect}"
|
74
|
-
lines << " Actual error: #{actual_error.class.name}: #{actual_error.message}"
|
75
|
-
end
|
76
|
-
else
|
77
|
-
if error
|
78
|
-
lines << " Expected error: #{error['class']}"
|
79
|
-
lines << " Actual result: #{actual_result.inspect}"
|
80
|
-
else
|
81
|
-
lines << " Expected: #{result.inspect}"
|
82
|
-
lines << " Actual: #{actual_result.inspect}"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
lines.join("\n")
|
86
|
-
else
|
87
|
-
"#{desc} #{name_str} #{status_code}#{error_code} #{call}"
|
88
|
-
end
|
89
|
-
end
|
90
55
|
|
91
56
|
def to_jsonl
|
92
57
|
{
|
@@ -114,39 +79,6 @@ module Stable
|
|
114
79
|
)
|
115
80
|
end
|
116
81
|
|
117
|
-
def _green(text)
|
118
|
-
"\e[32m#{text}\e[0m"
|
119
|
-
end
|
120
|
-
|
121
|
-
def _red(text)
|
122
|
-
"\e[31m#{text}\e[0m"
|
123
|
-
end
|
124
|
-
|
125
|
-
def _yellow(text)
|
126
|
-
"\e[33m#{text}\e[0m"
|
127
|
-
end
|
128
|
-
|
129
|
-
def _light_blue(text)
|
130
|
-
"\e[94m#{text}\e[0m"
|
131
|
-
end
|
132
|
-
|
133
|
-
def _status_code
|
134
|
-
case status
|
135
|
-
when :passed, :passed_with_error
|
136
|
-
_green('P')
|
137
|
-
when :failed
|
138
|
-
_red('F')
|
139
|
-
else
|
140
|
-
_yellow('?')
|
141
|
-
end
|
142
|
-
end
|
143
82
|
|
144
|
-
def _error_code
|
145
|
-
if error || actual_error
|
146
|
-
_light_blue('E')
|
147
|
-
else
|
148
|
-
_green('N')
|
149
|
-
end
|
150
|
-
end
|
151
83
|
end
|
152
84
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# lib/stable/formatters/colors.rb
|
2
|
+
module Stable
|
3
|
+
module Formatters
|
4
|
+
module Colors
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def green(text)
|
8
|
+
"\e[32m#{text}\e[0m"
|
9
|
+
end
|
10
|
+
|
11
|
+
def red(text)
|
12
|
+
"\e[31m#{text}\e[0m"
|
13
|
+
end
|
14
|
+
|
15
|
+
def yellow(text)
|
16
|
+
"\e[33m#{text}\e[0m"
|
17
|
+
end
|
18
|
+
|
19
|
+
def light_blue(text)
|
20
|
+
"\e[94m#{text}\e[0m"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# lib/stable/formatters/verbose.rb
|
2
|
+
require_relative 'colors'
|
3
|
+
|
4
|
+
module Stable
|
5
|
+
module Formatters
|
6
|
+
class Verbose
|
7
|
+
|
8
|
+
def initialize(facts)
|
9
|
+
@facts = facts
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s(fact)
|
13
|
+
short_uuid = fact.uuid.split('-').last
|
14
|
+
short_sig = fact.signature[0..6]
|
15
|
+
desc = "#{short_uuid}/#{short_sig}"
|
16
|
+
name_str = fact.name[..19].ljust(20)
|
17
|
+
call = "#{fact.class_name}##{fact.method_name}(#{fact.args.join(', ')})"
|
18
|
+
status_code = _status_code(fact)
|
19
|
+
error_code = _error_code(fact)
|
20
|
+
|
21
|
+
case fact.status
|
22
|
+
when :passed, :passed_with_error
|
23
|
+
"#{desc} #{name_str} #{status_code}#{error_code} #{call}"
|
24
|
+
when :failed
|
25
|
+
lines = ["#{desc} #{name_str} #{status_code}#{error_code} #{call}"]
|
26
|
+
if fact.actual_error
|
27
|
+
if fact.error
|
28
|
+
lines << " Expected error: #{fact.error['class']}"
|
29
|
+
lines << " Actual error: #{fact.actual_error.class.name}: #{fact.actual_error.message}"
|
30
|
+
else
|
31
|
+
lines << " Expected result: #{fact.result.inspect}"
|
32
|
+
lines << " Actual error: #{fact.actual_error.class.name}: #{fact.actual_error.message}"
|
33
|
+
end
|
34
|
+
else
|
35
|
+
if fact.error
|
36
|
+
lines << " Expected error: #{fact.error['class']}"
|
37
|
+
lines << " Actual result: #{fact.actual_result.inspect}"
|
38
|
+
else
|
39
|
+
lines << " Expected: #{fact.result.inspect}"
|
40
|
+
lines << " Actual: #{fact.actual_result.inspect}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
lines.join("\n")
|
44
|
+
else
|
45
|
+
"#{desc} #{name_str} #{status_code}#{error_code} #{call}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def header
|
50
|
+
header = "#{'uuid / sig'.ljust(20)} #{'name'.ljust(20)} st call"
|
51
|
+
"#{header}\n#{'-' * 20} #{'-' * 20} -- #{'-' * 35}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def summary
|
55
|
+
passing = @facts.count { |f| f.status == :passed || f.status == :passed_with_error }
|
56
|
+
failing = @facts.count { |f| f.status == :failed }
|
57
|
+
pending = @facts.count { |f| f.status == :pending }
|
58
|
+
"\n#{@facts.count} facts, #{passing} passing, #{pending} pending, #{failing} failing"
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def _status_code(fact)
|
65
|
+
case fact.status
|
66
|
+
when :passed, :passed_with_error
|
67
|
+
Colors.green('P')
|
68
|
+
when :failed
|
69
|
+
Colors.red('F')
|
70
|
+
else
|
71
|
+
Colors.yellow('?')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def _error_code(fact)
|
76
|
+
if fact.error || fact.actual_error
|
77
|
+
Colors.light_blue('E')
|
78
|
+
else
|
79
|
+
Colors.green('N')
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Lunt
|
@@ -34,6 +34,8 @@ files:
|
|
34
34
|
- lib/stable.rb
|
35
35
|
- lib/stable/configuration.rb
|
36
36
|
- lib/stable/fact.rb
|
37
|
+
- lib/stable/formatters/colors.rb
|
38
|
+
- lib/stable/formatters/verbose.rb
|
37
39
|
homepage: https://github.com/jefflunt/stable
|
38
40
|
licenses:
|
39
41
|
- MIT
|