kanoah_rspec_formatter 0.1.2 → 0.1.3.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e61de747c44665881b2c67e40521427e4d66ab2
|
4
|
+
data.tar.gz: ccd111f5fe76378bbb3cd6ec0e8cca0650fb7bc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da4efe354ef03611ea1152f7911bd7901bc9ddcf3163b45d026f6426d2a978686b474f17800aa9a51608a9d4be0769e52ea744ee80a3972ed96cbf70e1dbbec
|
7
|
+
data.tar.gz: c0495976df8760d445e17e611f4b645efcef63bf6d2f52723a26b788c62dc0dc84f2d363bb0c626e3bb165917abb5cea7824b030d6f1db1a0bc27871bcddca35
|
@@ -3,19 +3,26 @@ class KanoahResultFormatter < KanoahRSpecFormatter::BaseFormatter
|
|
3
3
|
|
4
4
|
RSpec::Core::Formatters.register self, *NOTIFICATIONS
|
5
5
|
|
6
|
+
def initialize(output)
|
7
|
+
@output = output
|
8
|
+
end
|
9
|
+
|
6
10
|
def start(notification)
|
7
11
|
super(notification)
|
8
12
|
end
|
9
13
|
|
10
14
|
def example_passed(notification)
|
15
|
+
format_output(notification.example)
|
11
16
|
proccess_result(notification.example) if notification.example.metadata.has_key?(:test_id) && !test_id(notification.example).empty?
|
12
17
|
end
|
13
18
|
|
14
19
|
def example_failed(notification)
|
20
|
+
format_output(notification.example)
|
15
21
|
proccess_result(notification.example) if notification.example.metadata.has_key?(:test_id) && !test_id(notification.example).empty?
|
16
22
|
end
|
17
23
|
|
18
24
|
def example_pending(notification)
|
25
|
+
format_output(notification.example)
|
19
26
|
proccess_result(notification.example) if notification.example.metadata.has_key?(:test_id) && !test_id(notification.example).empty?
|
20
27
|
end
|
21
28
|
|
@@ -25,6 +32,22 @@ class KanoahResultFormatter < KanoahRSpecFormatter::BaseFormatter
|
|
25
32
|
|
26
33
|
private
|
27
34
|
|
35
|
+
def format_output(example)
|
36
|
+
example.metadata[:steps].each do |step|
|
37
|
+
@output << "#{current_color(step[:status])}\s\s\s\s\sstep #{step[:index] + 1}: #{step.delete(:step_name)} \n"
|
38
|
+
@output << "\e[0m"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# TODO: get this to work with RSpec.configuration
|
43
|
+
def current_color(status)
|
44
|
+
case status
|
45
|
+
when 'Pass' then "\e[92m"
|
46
|
+
when 'Fail' then "\e[31m"
|
47
|
+
else "\e[93m"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
28
51
|
def proccess_result(example)
|
29
52
|
body = {
|
30
53
|
test_case: test_id(example),
|
@@ -4,10 +4,10 @@ module KanoahRSpecFormatter
|
|
4
4
|
@metadata[:steps] = [] if @metadata[:steps].nil?
|
5
5
|
begin
|
6
6
|
yield block
|
7
|
-
@metadata[:steps].push({ index: @metadata[:step_index], status: 'Pass' })
|
7
|
+
@metadata[:steps].push({ step_name: _step,index: @metadata[:step_index], status: 'Pass' })
|
8
8
|
rescue Exception => e
|
9
9
|
@exception = e
|
10
|
-
@metadata[:steps].push({ index: @metadata[:step_index], status: 'Fail', comment: e })
|
10
|
+
@metadata[:steps].push({ step_name: _step, index: @metadata[:step_index], status: 'Fail', comment: e })
|
11
11
|
fail
|
12
12
|
end
|
13
13
|
@metadata[:step_index] += 1 if @metadata.has_key?(:step_index)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanoah_rspec_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Automation Wizards
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|