fuubar-cucumber 0.0.4 → 0.0.5
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.
- data/VERSION +1 -1
- data/fuubar-cucumber.gemspec +2 -2
- data/lib/fuubar-cucumber.rb +57 -33
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/fuubar-cucumber.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fuubar-cucumber}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcin Ciunelis"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-30}
|
13
13
|
s.description = %q{the instafailing Cucumber progress bar formatter}
|
14
14
|
s.email = %q{marcin.ciunelis@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/fuubar-cucumber.rb
CHANGED
@@ -1,13 +1,26 @@
|
|
1
|
-
require 'cucumber/formatter/
|
1
|
+
require 'cucumber/formatter/console'
|
2
|
+
require 'cucumber/formatter/io'
|
2
3
|
|
3
4
|
module Cucumber
|
4
5
|
module Formatter
|
5
|
-
class Fuubar
|
6
|
+
class Fuubar
|
7
|
+
include Console
|
8
|
+
include Io
|
9
|
+
|
10
|
+
attr_reader :step_mother
|
6
11
|
|
7
12
|
def initialize(step_mother, path_or_io, options)
|
13
|
+
@step_mother, @io, @options = step_mother, ensure_io(path_or_io, "fuubar"), options
|
8
14
|
@step_count = @finished_count = @issues_count = 0
|
9
|
-
|
10
|
-
|
15
|
+
end
|
16
|
+
|
17
|
+
def after_features(features)
|
18
|
+
@io.print COLORS[state]
|
19
|
+
@progress_bar.finish
|
20
|
+
@io.print "\e[0m"
|
21
|
+
@io.puts
|
22
|
+
@io.puts
|
23
|
+
print_summary(features)
|
11
24
|
end
|
12
25
|
|
13
26
|
def before_features(features)
|
@@ -15,24 +28,17 @@ module Cucumber
|
|
15
28
|
@progress_bar = ProgressBar.new(" #{@step_count} steps", @step_count, @io)
|
16
29
|
@progress_bar.bar_mark = '='
|
17
30
|
end
|
18
|
-
|
31
|
+
|
19
32
|
def before_background(background)
|
20
33
|
@in_background = true
|
21
34
|
end
|
22
|
-
|
35
|
+
|
23
36
|
def after_background(background)
|
24
37
|
@in_background = false
|
25
38
|
end
|
26
39
|
|
27
|
-
def after_features(features)
|
28
|
-
@io.print COLORS[state]
|
29
|
-
@progress_bar.finish
|
30
|
-
@io.print "\e[0m"
|
31
|
-
super
|
32
|
-
end
|
33
|
-
|
34
40
|
def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
35
|
-
return if @in_background
|
41
|
+
return if @in_background || status == :skipped
|
36
42
|
@state = :red if status == :failed
|
37
43
|
if [:failed, :undefined].include? status
|
38
44
|
@io.print "\e[K"
|
@@ -43,11 +49,30 @@ module Cucumber
|
|
43
49
|
@io.puts
|
44
50
|
@io.flush
|
45
51
|
end
|
46
|
-
|
52
|
+
progress(status)
|
47
53
|
end
|
48
54
|
|
49
|
-
|
55
|
+
def before_examples(examples)
|
56
|
+
@is_example = true
|
57
|
+
end
|
58
|
+
|
59
|
+
def after_exaples(examples)
|
60
|
+
@is_example = false
|
61
|
+
end
|
62
|
+
|
63
|
+
def before_table_row(table_row)
|
64
|
+
if @is_example && table_row.scenario_outline
|
65
|
+
progress(:passed, table_row.scenario_outline.instance_variable_get("@background").instance_variable_get("@steps").count)
|
66
|
+
end
|
67
|
+
end
|
50
68
|
|
69
|
+
def after_table_row(table_row)
|
70
|
+
if @is_example && table_row.scenario_outline
|
71
|
+
progress(:passed, table_row.scenario_outline.instance_variable_get("@steps").count)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
protected
|
51
76
|
def state
|
52
77
|
@state ||= :green
|
53
78
|
end
|
@@ -58,20 +83,12 @@ module Cucumber
|
|
58
83
|
print_passing_wip(@options)
|
59
84
|
end
|
60
85
|
|
61
|
-
CHARS = {
|
62
|
-
:passed => '.',
|
63
|
-
:failed => 'F',
|
64
|
-
:undefined => 'U',
|
65
|
-
:pending => 'P',
|
66
|
-
:skipped => '-'
|
67
|
-
}
|
68
|
-
|
69
86
|
COLORS = { :green => "\e[32m", :yellow => "\e[33m", :red => "\e[31m" }
|
70
87
|
|
71
|
-
def progress(status)
|
88
|
+
def progress(status = 'passed', count = 1)
|
72
89
|
@io.print COLORS[state]
|
73
|
-
@finished_count +=
|
74
|
-
@progress_bar.inc
|
90
|
+
@finished_count += count
|
91
|
+
@progress_bar.inc(count)
|
75
92
|
@progress_bar.instance_variable_set("@title", " #{@finished_count}/#{@step_count}")
|
76
93
|
@io.print "\e[0m"
|
77
94
|
end
|
@@ -80,19 +97,26 @@ module Cucumber
|
|
80
97
|
count = 0
|
81
98
|
features = features.instance_variable_get("@features")
|
82
99
|
features.each do |feature|
|
83
|
-
|
100
|
+
if feature.instance_variable_get("@background")
|
101
|
+
background = feature.instance_variable_get("@background")
|
102
|
+
background.init
|
103
|
+
background_steps = background.instance_variable_get("@steps").instance_variable_get("@steps")
|
104
|
+
end
|
84
105
|
feature.instance_variable_get("@feature_elements").each do |scenario|
|
85
106
|
scenario.init
|
86
|
-
#get steps
|
87
107
|
steps = scenario.instance_variable_get("@steps").instance_variable_get("@steps")
|
88
|
-
|
89
|
-
|
108
|
+
scenario_size = steps.size
|
109
|
+
if background_steps && scenario.is_a?(Cucumber::Ast::ScenarioOutline)
|
110
|
+
background_size = background_steps.size
|
111
|
+
end
|
90
112
|
examples = scenario.instance_variable_get("@examples_array")
|
91
|
-
|
113
|
+
if examples
|
92
114
|
examples.each do |example|
|
93
115
|
example_matrix = example.instance_variable_get("@outline_table").instance_variable_get("@cell_matrix")
|
94
|
-
count += example_matrix.size
|
116
|
+
count += (scenario_size + background_size)*(example_matrix.size - 1)
|
95
117
|
end
|
118
|
+
else
|
119
|
+
count += scenario_size
|
96
120
|
end
|
97
121
|
end
|
98
122
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fuubar-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marcin Ciunelis
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-30 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|