kanoah_rspec_formatter 0.2.0 → 0.2.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: 0235e51a6b5a2f2e062ea4c9a61924483d25fb53
4
- data.tar.gz: 71b1c7d618eb4d4fc7d66643fc33d2ee9de08cba
3
+ metadata.gz: f214a42fcbc7e69600a91297914bf449ddbbabd4
4
+ data.tar.gz: dfa01a3942e2feb16416a136c7abb40c88e56229
5
5
  SHA512:
6
- metadata.gz: 20fcd45cad1e7b48efc5dcb144fde233d89d76ea70b72220eb62f95370724e25ab6f4275f1d681936c33a4e886b2d5d91be7352c825826ab7e88f1f8fdb1369c
7
- data.tar.gz: 435d22006e7c1ff09dfe1fcc3c32ff8ac6c2446395ec746b71ebf32d4e65ac33ede56400af25214460129ac485cfda626cb510618fa0cf593b1b3d163b037003
6
+ metadata.gz: b67c48b8f012309db7ffe7a8964042b4ecb976c61dd0af7d135db82339000949bd7e76841f46cf7838162a4cc11713449acd7e2969521266f66faeb5894c48ab
7
+ data.tar.gz: 49730a9a76bf7b123573d4ffe33996e010144302efb39056582c7040d58fe5f809b8166a29ef33a9976035c8b515bd4170855ba27d61ef598b0407e7064bd542
@@ -1,11 +1,24 @@
1
- class KanoahOutputFormatter < RSpec::Core::Formatters::DocumentationFormatter
2
- RSpec::Core::Formatters.register self, :example_group_finished, :example_passed, :example_failed, :dump_failures, :dump_summary
1
+ require 'rspec/core/formatters/base_text_formatter'
2
+ class KanoahOutputFormatter < RSpec::Core::Formatters::BaseTextFormatter
3
+ RSpec::Core::Formatters.register self, :example_group_started, :example_group_finished,
4
+ :example_passed, :example_pending, :example_failed, :example_started
3
5
 
4
6
  def initialize(output)
5
7
  super
6
8
  @group_level = 0
7
9
  end
8
10
 
11
+ def example_started(notification)
12
+ notification.example.metadata[:step_index] = 0
13
+ end
14
+
15
+ def example_group_started(notification)
16
+ output.puts if @group_level == 0
17
+ output.puts "#{current_indentation}#{notification.group.description.strip}"
18
+
19
+ @group_level += 1
20
+ end
21
+
9
22
  def example_group_finished(_notification)
10
23
  @group_level -= 1
11
24
  end
@@ -14,6 +27,11 @@ class KanoahOutputFormatter < RSpec::Core::Formatters::DocumentationFormatter
14
27
  passed_output(passed.example)
15
28
  end
16
29
 
30
+ def example_pending(pending)
31
+ pending_output(pending.example,
32
+ pending.example.execution_result.pending_message)
33
+ end
34
+
17
35
  def example_failed(failure)
18
36
  failure_output(failure.example)
19
37
  end
@@ -21,15 +39,32 @@ class KanoahOutputFormatter < RSpec::Core::Formatters::DocumentationFormatter
21
39
  private
22
40
 
23
41
  def passed_output(example)
24
- super(example)
42
+ output.puts RSpec::Core::Formatters::ConsoleCodes.wrap("#{current_indentation}#{example.description.strip}", :success)
25
43
  format_output(example)
26
44
  end
27
45
 
46
+ def pending_output(example, message)
47
+ output.puts RSpec::Core::Formatters::ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} " \
48
+ "(PENDING: #{message})",
49
+ :pending)
50
+ end
51
+
28
52
  def failure_output(example)
29
- super(example)
53
+ output.puts RSpec::Core::Formatters::ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} " \
54
+ "(FAILED - #{next_failure_index})",
55
+ :failure)
30
56
  format_output(example)
31
57
  end
32
58
 
59
+ def next_failure_index
60
+ @next_failure_index ||= 0
61
+ @next_failure_index += 1
62
+ end
63
+
64
+ def current_indentation
65
+ ' ' * @group_level
66
+ end
67
+
33
68
  def format_output(example)
34
69
  example.metadata[:steps].each do |step|
35
70
  output.puts RSpec::Core::Formatters::ConsoleCodes.wrap("#{' ' * (@group_level + 1)}step #{step[:index] + 1}: #{step[:step_name]}",current_color(step[:status]))
@@ -1,3 +1,3 @@
1
1
  module KanoahRSpecFormatter
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanoah_rspec_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Automation Wizards