kanoah_rspec_formatter 0.1.2 → 0.1.3.1

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
  SHA1:
3
- metadata.gz: a804ffe3fa434d3595fca13a4f8337e73053ae2b
4
- data.tar.gz: e8594e824879bb706549e74914eb3357381b03ae
3
+ metadata.gz: 1e61de747c44665881b2c67e40521427e4d66ab2
4
+ data.tar.gz: ccd111f5fe76378bbb3cd6ec0e8cca0650fb7bc4
5
5
  SHA512:
6
- metadata.gz: 698e825a73f9bf3860a43278b25cf378772530f38461a8080cf38043386d123669b42f12defac17b2f1491d9a9c41884a2ca859b93ece910ec9ee05f75072fac
7
- data.tar.gz: 4bd80b7a7bac647b14918dbc329b6e5aee18029b13c7be7c3c245bc582b1cd7aaf5ef8294ead9ffdfda46cb1cac75a04047192ae9b46b8ee14d49199909bcd26
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)
@@ -1,3 +1,3 @@
1
1
  module KanoahRSpecFormatter
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3.1'
3
3
  end
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.2
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-13 00:00:00.000000000 Z
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler