cucumber 1.2.1 → 1.2.2
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/.rvmrc +1 -1
- data/.travis.yml +3 -2
- data/DEVELOPERS.md +48 -0
- data/History.md +22 -3
- data/README.md +13 -31
- data/Rakefile +1 -0
- data/cucumber.gemspec +18 -17
- data/cucumber.yml +3 -2
- data/examples/i18n/cs/Rakefile +6 -0
- data/examples/i18n/cs/features/addition.feature +17 -0
- data/examples/i18n/cs/features/division.feature +11 -0
- data/examples/i18n/cs/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/cs/lib/calculator.rb +14 -0
- data/examples/i18n/hi/Rakefile +6 -0
- data/examples/i18n/hi/features/addition.feature +16 -0
- data/examples/i18n/hi/features/division.feature +10 -0
- data/examples/i18n/hi/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/hi/lib/calculator.rb +15 -0
- data/examples/python/README.textile +2 -1
- data/examples/ruby2python/README.textile +2 -1
- data/features/.cucumber/stepdefs.json +1688 -445
- data/features/assertions.feature +69 -0
- data/features/formatter_callbacks.feature +189 -0
- data/features/html_formatter.feature +19 -0
- data/features/json_formatter.feature +8 -4
- data/features/nested_steps_with_second_arg.feature +73 -0
- data/features/step_definitions.feature +65 -0
- data/features/step_definitions/cucumber_steps.rb +18 -3
- data/fixtures/self_test/features/support/env.rb +1 -1
- data/gem_tasks/cucumber.rake +5 -3
- data/gem_tasks/downloads.rb +3 -3
- data/gem_tasks/stats +4 -2
- data/gem_tasks/yard.rake +31 -13
- data/legacy_features/default_snippets.feature +3 -3
- data/legacy_features/language_help.feature +4 -0
- data/legacy_features/report_called_undefined_steps.feature +1 -1
- data/legacy_features/snippet.feature +3 -3
- data/legacy_features/snippets_when_using_star_keyword.feature +1 -1
- data/legacy_features/step_definitions/cucumber_steps.rb +4 -3
- data/legacy_features/support/env.rb +1 -1
- data/legacy_features/support/fake_wire_server.rb +9 -9
- data/lib/autotest/cucumber_mixin.rb +14 -14
- data/lib/autotest/discover.rb +2 -0
- data/lib/cucumber.rb +2 -2
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +11 -7
- data/lib/cucumber/ast/comment.rb +2 -2
- data/lib/cucumber/ast/doc_string.rb +1 -1
- data/lib/cucumber/ast/examples.rb +1 -1
- data/lib/cucumber/ast/feature.rb +2 -2
- data/lib/cucumber/ast/feature_element.rb +1 -1
- data/lib/cucumber/ast/multiline_argument.rb +2 -2
- data/lib/cucumber/ast/names.rb +2 -2
- data/lib/cucumber/ast/outline_table.rb +4 -5
- data/lib/cucumber/ast/scenario.rb +14 -14
- data/lib/cucumber/ast/scenario_outline.rb +4 -4
- data/lib/cucumber/ast/step.rb +3 -3
- data/lib/cucumber/ast/step_collection.rb +5 -5
- data/lib/cucumber/ast/step_invocation.rb +8 -8
- data/lib/cucumber/ast/table.rb +40 -27
- data/lib/cucumber/ast/tree_walker.rb +9 -8
- data/lib/cucumber/ast/visitor.rb +1 -1
- data/lib/cucumber/cli/configuration.rb +10 -10
- data/lib/cucumber/cli/drb_client.rb +1 -1
- data/lib/cucumber/cli/main.rb +3 -3
- data/lib/cucumber/cli/options.rb +3 -2
- data/lib/cucumber/cli/profile_loader.rb +1 -1
- data/lib/cucumber/configuration.rb +12 -12
- data/lib/cucumber/constantize.rb +11 -2
- data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +1 -1
- data/lib/cucumber/core_ext/instance_exec.rb +4 -4
- data/lib/cucumber/core_ext/proc.rb +3 -3
- data/lib/cucumber/errors.rb +1 -1
- data/lib/cucumber/feature_file.rb +1 -1
- data/lib/cucumber/formatter/ansicolor.rb +36 -23
- data/lib/cucumber/formatter/console.rb +45 -25
- data/lib/cucumber/formatter/debug.rb +7 -7
- data/lib/cucumber/formatter/duration.rb +1 -1
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +7 -0
- data/lib/cucumber/formatter/gpretty.rb +1 -1
- data/lib/cucumber/formatter/html.rb +52 -53
- data/lib/cucumber/formatter/interceptor.rb +2 -2
- data/lib/cucumber/formatter/json.rb +1 -1
- data/lib/cucumber/formatter/json_pretty.rb +2 -1
- data/lib/cucumber/formatter/junit.rb +1 -1
- data/lib/cucumber/formatter/ordered_xml_markup.rb +1 -1
- data/lib/cucumber/formatter/pretty.rb +12 -12
- data/lib/cucumber/formatter/progress.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +5 -5
- data/lib/cucumber/formatter/stepdefs.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +6 -6
- data/lib/cucumber/formatter/summary.rb +6 -6
- data/lib/cucumber/formatter/unicode.rb +18 -18
- data/lib/cucumber/formatter/usage.rb +7 -7
- data/lib/cucumber/js_support/js_dsl.js +1 -1
- data/lib/cucumber/language_support.rb +1 -1
- data/lib/cucumber/parser/gherkin_builder.rb +33 -33
- data/lib/cucumber/platform.rb +3 -2
- data/lib/cucumber/py_support/py_dsl.py +2 -2
- data/lib/cucumber/py_support/py_language.py +2 -2
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +4 -3
- data/lib/cucumber/rb_support/rb_dsl.rb +10 -10
- data/lib/cucumber/rb_support/rb_language.rb +27 -19
- data/lib/cucumber/rb_support/rb_step_definition.rb +39 -11
- data/lib/cucumber/rb_support/rb_transform.rb +3 -3
- data/lib/cucumber/rb_support/rb_world.rb +15 -15
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +1 -1
- data/lib/cucumber/rspec/disable_option_parser.rb +1 -1
- data/lib/cucumber/rspec/doubles.rb +1 -1
- data/lib/cucumber/runtime.rb +11 -10
- data/lib/cucumber/runtime/features_loader.rb +6 -6
- data/lib/cucumber/runtime/for_programming_languages.rb +8 -15
- data/lib/cucumber/runtime/results.rb +6 -6
- data/lib/cucumber/runtime/support_code.rb +37 -28
- data/lib/cucumber/runtime/user_interface.rb +4 -4
- data/lib/cucumber/step_definition_light.rb +4 -4
- data/lib/cucumber/step_definitions.rb +2 -3
- data/lib/cucumber/step_match.rb +6 -6
- data/lib/cucumber/step_mother.rb +1 -1
- data/lib/cucumber/term/ansicolor.rb +22 -22
- data/lib/cucumber/wire_support/configuration.rb +11 -14
- data/lib/cucumber/wire_support/connection.rb +10 -9
- data/lib/cucumber/wire_support/request_handler.rb +3 -3
- data/lib/cucumber/wire_support/wire_exception.rb +3 -3
- data/lib/cucumber/wire_support/wire_language.rb +11 -11
- data/lib/cucumber/wire_support/wire_packet.rb +7 -5
- data/lib/cucumber/wire_support/wire_protocol.rb +6 -6
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +20 -20
- data/lib/cucumber/wire_support/wire_step_definition.rb +4 -4
- data/spec/cucumber/ast/background_spec.rb +4 -4
- data/spec/cucumber/ast/doc_string_spec.rb +8 -8
- data/spec/cucumber/ast/feature_factory.rb +4 -4
- data/spec/cucumber/ast/feature_spec.rb +18 -18
- data/spec/cucumber/ast/outline_table_spec.rb +3 -3
- data/spec/cucumber/ast/step_spec.rb +4 -4
- data/spec/cucumber/ast/table_spec.rb +50 -29
- data/spec/cucumber/ast/tree_walker_spec.rb +12 -4
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +10 -4
- data/spec/cucumber/cli/drb_client_spec.rb +1 -1
- data/spec/cucumber/cli/main_spec.rb +28 -7
- data/spec/cucumber/cli/options_spec.rb +3 -3
- data/spec/cucumber/configuration_spec.rb +4 -4
- data/spec/cucumber/constantize_spec.rb +2 -0
- data/spec/cucumber/core_ext/proc_spec.rb +7 -7
- data/spec/cucumber/formatter/ansicolor_spec.rb +2 -2
- data/spec/cucumber/formatter/duration_spec.rb +2 -2
- data/spec/cucumber/formatter/html_spec.rb +31 -31
- data/spec/cucumber/formatter/interceptor_spec.rb +10 -0
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +7 -7
- data/spec/cucumber/rake/forked_spec.rb +15 -2
- data/spec/cucumber/rake/rcov_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_language_spec.rb +34 -17
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +45 -35
- data/spec/cucumber/rb_support/rb_transform_spec.rb +3 -3
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +31 -0
- data/spec/cucumber/runtime/results_spec.rb +5 -5
- data/spec/cucumber/runtime/support_code_spec.rb +13 -2
- data/spec/cucumber/runtime_spec.rb +7 -7
- data/spec/cucumber/step_match_spec.rb +2 -2
- data/spec/cucumber/wire_support/configuration_spec.rb +16 -6
- data/spec/cucumber/wire_support/connection_spec.rb +25 -11
- data/spec/cucumber/wire_support/wire_exception_spec.rb +3 -3
- data/spec/cucumber/wire_support/wire_language_spec.rb +3 -3
- data/spec/cucumber/wire_support/wire_packet_spec.rb +4 -4
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +98 -128
- data/legacy_features/html_formatter.feature +0 -8
- data/legacy_features/html_formatter/a.html +0 -561
@@ -4,15 +4,32 @@ require 'cucumber/formatter/summary'
|
|
4
4
|
|
5
5
|
module Cucumber
|
6
6
|
module Formatter
|
7
|
-
|
8
|
-
# that
|
7
|
+
|
8
|
+
# This module contains helper methods that are used by formatters that
|
9
|
+
# print output to the terminal.
|
10
|
+
#
|
11
|
+
# FORMAT is a hash of Proc objects, keyed by step-definition types, e.g.
|
12
|
+
# "FORMAT[:passed]". The Proc is called for each line of the step's
|
13
|
+
# output.
|
14
|
+
#
|
15
|
+
# format_step calls format_string, format_string calls format_for to obtain
|
16
|
+
# the formatting Proc.
|
17
|
+
#
|
18
|
+
# Example:
|
19
|
+
#
|
20
|
+
# The ANSI color console formatter defines a map of step-type to output
|
21
|
+
# color (e.g. "passed" to "green"), then builds methods named for the
|
22
|
+
# step-types (e.g. "def passed"), which themselves wrap the corresponding
|
23
|
+
# color-named methods provided by Term::ANSIColor (e.g. "def red").
|
24
|
+
#
|
25
|
+
# During output, each line is processed by passing it to the formatter Proc
|
26
|
+
# which returns the formatted (e.g. colored) string.
|
27
|
+
|
9
28
|
module Console
|
10
29
|
extend ANSIColor
|
11
30
|
include Duration
|
12
31
|
include Summary
|
13
32
|
|
14
|
-
FORMATS = Hash.new{|hash, format| hash[format] = method(format).to_proc}
|
15
|
-
|
16
33
|
def format_step(keyword, step_match, status, source_indent)
|
17
34
|
comment = if source_indent
|
18
35
|
c = (' # ' + step_match.file_colon_line).indent(source_indent)
|
@@ -38,7 +55,7 @@ module Cucumber
|
|
38
55
|
end
|
39
56
|
|
40
57
|
def print_steps(status)
|
41
|
-
print_elements(
|
58
|
+
print_elements(runtime.steps(status), status, 'steps')
|
42
59
|
end
|
43
60
|
|
44
61
|
def print_elements(elements, status, kind)
|
@@ -60,10 +77,10 @@ module Cucumber
|
|
60
77
|
end
|
61
78
|
|
62
79
|
def print_stats(features, options)
|
63
|
-
@failures =
|
80
|
+
@failures = runtime.scenarios(:failed).select { |s| s.is_a?(Cucumber::Ast::Scenario) || s.is_a?(Cucumber::Ast::OutlineTable::ExampleRow) }
|
64
81
|
@failures.collect! { |s| (s.is_a?(Cucumber::Ast::OutlineTable::ExampleRow)) ? s.scenario_outline : s }
|
65
82
|
|
66
|
-
if !@failures.empty?
|
83
|
+
if !@failures.empty?
|
67
84
|
@io.puts format_string("Failing Scenarios:", :failed)
|
68
85
|
@failures.each do |failure|
|
69
86
|
profiles_string = options.custom_profiles.empty? ? '' : (options.custom_profiles.map{|profile| "-p #{profile}" }).join(' ') + ' '
|
@@ -73,8 +90,8 @@ module Cucumber
|
|
73
90
|
@io.puts
|
74
91
|
end
|
75
92
|
|
76
|
-
@io.puts scenario_summary(
|
77
|
-
@io.puts step_summary(
|
93
|
+
@io.puts scenario_summary(runtime) {|status_count, status| format_string(status_count, status)}
|
94
|
+
@io.puts step_summary(runtime) {|status_count, status| format_string(status_count, status)}
|
78
95
|
|
79
96
|
@io.puts(format_duration(features.duration)) if features && features.duration
|
80
97
|
|
@@ -90,22 +107,22 @@ module Cucumber
|
|
90
107
|
string = "#{message}\n#{e.backtrace.join("\n")}".indent(indent)
|
91
108
|
@io.puts(format_string(string, status))
|
92
109
|
end
|
93
|
-
|
94
|
-
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/10655
|
110
|
+
|
111
|
+
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/10655
|
95
112
|
def linebreaks(s, max)
|
96
113
|
s.gsub(/.{1,#{max}}(?:\s|\Z)/){($& + 5.chr).gsub(/\n\005/,"\n").gsub(/\005/,"\n")}.rstrip
|
97
114
|
end
|
98
115
|
|
99
116
|
def print_snippets(options)
|
100
117
|
return unless options[:snippets]
|
101
|
-
undefined =
|
118
|
+
undefined = runtime.steps(:undefined)
|
102
119
|
return if undefined.empty?
|
103
|
-
|
104
|
-
unknown_programming_language =
|
120
|
+
|
121
|
+
unknown_programming_language = runtime.unknown_programming_language?
|
105
122
|
snippets = undefined.map do |step|
|
106
123
|
step_name = Undefined === step.exception ? step.exception.step_name : step.name
|
107
124
|
step_multiline_class = step.multiline_arg ? step.multiline_arg.class : nil
|
108
|
-
snippet = @
|
125
|
+
snippet = @runtime.snippet_text(step.actual_keyword, step_name, step_multiline_class)
|
109
126
|
snippet
|
110
127
|
end.compact.uniq
|
111
128
|
|
@@ -114,9 +131,9 @@ module Cucumber
|
|
114
131
|
@io.puts format_string(text, :undefined)
|
115
132
|
|
116
133
|
if unknown_programming_language
|
117
|
-
@io.puts format_string("\nIf you want snippets in a different programming language
|
118
|
-
|
119
|
-
|
134
|
+
@io.puts format_string("\nIf you want snippets in a different programming language," +
|
135
|
+
"\njust make sure a file with the appropriate file extension" +
|
136
|
+
"\nexists where cucumber looks for step definitions.", :failed)
|
120
137
|
end
|
121
138
|
|
122
139
|
@io.puts
|
@@ -125,7 +142,7 @@ module Cucumber
|
|
125
142
|
|
126
143
|
def print_passing_wip(options)
|
127
144
|
return unless options[:wip]
|
128
|
-
passed =
|
145
|
+
passed = runtime.scenarios(:passed)
|
129
146
|
if passed.any?
|
130
147
|
@io.puts format_string("\nThe --wip switch was used, so I didn't expect anything to pass. These scenarios passed:", :failed)
|
131
148
|
print_elements(passed, :passed, "scenarios")
|
@@ -177,12 +194,15 @@ module Cucumber
|
|
177
194
|
|
178
195
|
private
|
179
196
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
197
|
+
FORMATS = Hash.new{ |hash, format| hash[format] = method(format).to_proc }
|
198
|
+
|
199
|
+
def format_for(*keys)
|
200
|
+
key = keys.join('_').to_sym
|
201
|
+
fmt = FORMATS[key]
|
202
|
+
raise "No format for #{key.inspect}: #{FORMATS.inspect}" if fmt.nil?
|
203
|
+
fmt
|
204
|
+
end
|
205
|
+
|
186
206
|
end
|
187
207
|
end
|
188
208
|
end
|
@@ -4,30 +4,30 @@ require 'cucumber/step_definition_light'
|
|
4
4
|
module Cucumber
|
5
5
|
module Formatter
|
6
6
|
class Debug
|
7
|
-
def initialize(
|
7
|
+
def initialize(runtime, io, options)
|
8
8
|
@io = io
|
9
9
|
@indent = 0
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def respond_to?(*args)
|
13
13
|
true
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def method_missing(name, *args)
|
17
17
|
@indent -= 2 if name.to_s =~ /^after/
|
18
18
|
print(name)
|
19
19
|
@indent += 2 if name.to_s =~ /^before/
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
private
|
23
|
-
|
23
|
+
|
24
24
|
def print(text)
|
25
25
|
@io.puts "#{indent}#{text}"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def indent
|
29
29
|
(' ' * @indent)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
end
|
33
|
+
end
|
@@ -44,6 +44,7 @@ module Cucumber
|
|
44
44
|
end
|
45
45
|
@gf.match(match)
|
46
46
|
end
|
47
|
+
@step_time = Time.now
|
47
48
|
end
|
48
49
|
|
49
50
|
def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
|
@@ -66,6 +67,12 @@ module Cucumber
|
|
66
67
|
def before_examples(examples)
|
67
68
|
@gf.examples(examples.gherkin_statement)
|
68
69
|
end
|
70
|
+
|
71
|
+
#used for capturing duration
|
72
|
+
def after_step(step)
|
73
|
+
step_finish = (Time.now - @step_time)
|
74
|
+
@gf.append_duration(step_finish)
|
75
|
+
end
|
69
76
|
|
70
77
|
def after_feature(feature)
|
71
78
|
@gf.eof
|
@@ -9,7 +9,7 @@ module Cucumber
|
|
9
9
|
class Gpretty < GherkinFormatterAdapter
|
10
10
|
include Io
|
11
11
|
|
12
|
-
def initialize(
|
12
|
+
def initialize(runtime, io, options)
|
13
13
|
@io = ensure_io(io, "json")
|
14
14
|
super(Gherkin::Formatter::PrettyFormatter.new(@io, false), true)
|
15
15
|
end
|
@@ -10,9 +10,9 @@ module Cucumber
|
|
10
10
|
include Duration
|
11
11
|
include Io
|
12
12
|
|
13
|
-
def initialize(
|
13
|
+
def initialize(runtime, path_or_io, options)
|
14
14
|
@io = ensure_io(path_or_io, "html")
|
15
|
-
@
|
15
|
+
@runtime = runtime
|
16
16
|
@options = options
|
17
17
|
@buffer = {}
|
18
18
|
@builder = create_builder(@io)
|
@@ -47,15 +47,15 @@ module Cucumber
|
|
47
47
|
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
48
48
|
@builder.declare!(
|
49
49
|
:DOCTYPE,
|
50
|
-
:html,
|
51
|
-
:PUBLIC,
|
50
|
+
:html,
|
51
|
+
:PUBLIC,
|
52
52
|
'-//W3C//DTD XHTML 1.0 Strict//EN',
|
53
53
|
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
|
54
54
|
)
|
55
55
|
|
56
56
|
@builder << '<html xmlns ="http://www.w3.org/1999/xhtml">'
|
57
57
|
@builder.head do
|
58
|
-
@builder.meta(:content => 'text/html;charset=utf-8')
|
58
|
+
@builder.meta('http-equiv' => 'Content-Type', :content => 'text/html;charset=utf-8')
|
59
59
|
@builder.title 'Cucumber'
|
60
60
|
inline_css
|
61
61
|
inline_js
|
@@ -93,7 +93,7 @@ module Cucumber
|
|
93
93
|
def after_feature(feature)
|
94
94
|
@builder << '</div>'
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
def before_comment(comment)
|
98
98
|
@builder << '<pre class="comment">'
|
99
99
|
end
|
@@ -101,22 +101,22 @@ module Cucumber
|
|
101
101
|
def after_comment(comment)
|
102
102
|
@builder << '</pre>'
|
103
103
|
end
|
104
|
-
|
104
|
+
|
105
105
|
def comment_line(comment_line)
|
106
106
|
@builder.text!(comment_line)
|
107
107
|
@builder.br
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
def after_tags(tags)
|
111
111
|
@tag_spacer = nil
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
def tag_name(tag_name)
|
115
115
|
@builder.text!(@tag_spacer) if @tag_spacer
|
116
116
|
@tag_spacer = ' '
|
117
117
|
@builder.span(tag_name, :class => 'tag')
|
118
118
|
end
|
119
|
-
|
119
|
+
|
120
120
|
def feature_name(keyword, name)
|
121
121
|
lines = name.split(/\r?\n/)
|
122
122
|
return if lines.empty?
|
@@ -130,17 +130,17 @@ module Cucumber
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
def before_background(background)
|
135
135
|
@in_background = true
|
136
136
|
@builder << '<div class="background">'
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
def after_background(background)
|
140
140
|
@in_background = nil
|
141
141
|
@builder << '</div>'
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
def background_name(keyword, name, file_colon_line, source_indent)
|
145
145
|
@listing_background = true
|
146
146
|
@builder.h3(:id => "background_#{@scenario_number}") do |h3|
|
@@ -156,7 +156,7 @@ module Cucumber
|
|
156
156
|
css_class = {
|
157
157
|
Ast::Scenario => 'scenario',
|
158
158
|
Ast::ScenarioOutline => 'scenario outline'
|
159
|
-
}[feature_element.class]
|
159
|
+
}[feature_element.class]
|
160
160
|
@builder << "<div class='#{css_class}'>"
|
161
161
|
end
|
162
162
|
|
@@ -176,21 +176,21 @@ module Cucumber
|
|
176
176
|
@builder.span(name, :class => 'val')
|
177
177
|
end
|
178
178
|
end
|
179
|
-
|
179
|
+
|
180
180
|
def before_outline_table(outline_table)
|
181
181
|
@outline_row = 0
|
182
182
|
@builder << '<table>'
|
183
183
|
end
|
184
|
-
|
184
|
+
|
185
185
|
def after_outline_table(outline_table)
|
186
186
|
@builder << '</table>'
|
187
187
|
@outline_row = nil
|
188
188
|
end
|
189
|
-
|
189
|
+
|
190
190
|
def before_examples(examples)
|
191
191
|
@builder << '<div class="examples">'
|
192
192
|
end
|
193
|
-
|
193
|
+
|
194
194
|
def after_examples(examples)
|
195
195
|
@builder << '</div>'
|
196
196
|
end
|
@@ -202,11 +202,11 @@ module Cucumber
|
|
202
202
|
@builder.span(name, :class => 'val')
|
203
203
|
end
|
204
204
|
end
|
205
|
-
|
205
|
+
|
206
206
|
def before_steps(steps)
|
207
207
|
@builder << '<ol>'
|
208
208
|
end
|
209
|
-
|
209
|
+
|
210
210
|
def after_steps(steps)
|
211
211
|
@builder << '</ol>'
|
212
212
|
end
|
@@ -237,17 +237,18 @@ module Cucumber
|
|
237
237
|
end
|
238
238
|
@status = status
|
239
239
|
return if @hide_this_step
|
240
|
-
set_scenario_color(status)
|
241
|
-
@builder << "<li id='#{@step_id}' class='step #{status}'>"
|
240
|
+
set_scenario_color(status)
|
241
|
+
@builder << "<li id='#{@step_id}' class='step #{status}'>"
|
242
242
|
end
|
243
243
|
|
244
244
|
def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
|
245
245
|
return if @hide_this_step
|
246
246
|
# print snippet for undefined steps
|
247
247
|
if status == :undefined
|
248
|
+
keyword = @step.actual_keyword if @step.respond_to?(:actual_keyword)
|
248
249
|
step_multiline_class = @step.multiline_arg ? @step.multiline_arg.class : nil
|
249
250
|
@builder.pre do |pre|
|
250
|
-
pre << @
|
251
|
+
pre << @runtime.snippet_text(keyword,step_match.instance_variable_get("@name") || '',step_multiline_class)
|
251
252
|
end
|
252
253
|
end
|
253
254
|
@builder << '</li>'
|
@@ -255,10 +256,8 @@ module Cucumber
|
|
255
256
|
end
|
256
257
|
|
257
258
|
def step_name(keyword, step_match, status, source_indent, background, file_colon_line)
|
258
|
-
@step_matches ||= []
|
259
259
|
background_in_scenario = background && !@listing_background
|
260
|
-
@skip_step =
|
261
|
-
@step_matches << step_match
|
260
|
+
@skip_step = background_in_scenario
|
262
261
|
|
263
262
|
unless @skip_step
|
264
263
|
build_step(keyword, step_match, status)
|
@@ -280,7 +279,7 @@ module Cucumber
|
|
280
279
|
@builder << '<table>'
|
281
280
|
end
|
282
281
|
end
|
283
|
-
|
282
|
+
|
284
283
|
def after_multiline_arg(multiline_arg)
|
285
284
|
return if @hide_this_step || @skip_step
|
286
285
|
if Ast::Table === multiline_arg
|
@@ -294,15 +293,15 @@ module Cucumber
|
|
294
293
|
@builder << h(string).gsub("\n", '
')
|
295
294
|
end
|
296
295
|
end
|
297
|
-
|
298
|
-
|
296
|
+
|
297
|
+
|
299
298
|
def before_table_row(table_row)
|
300
299
|
@row_id = table_row.dom_id
|
301
300
|
@col_index = 0
|
302
301
|
return if @hide_this_step
|
303
302
|
@builder << "<tr class='step' id='#{@row_id}'>"
|
304
303
|
end
|
305
|
-
|
304
|
+
|
306
305
|
def after_table_row(table_row)
|
307
306
|
return if @hide_this_step
|
308
307
|
print_table_row_messages
|
@@ -326,7 +325,7 @@ module Cucumber
|
|
326
325
|
|
327
326
|
def table_cell_value(value, status)
|
328
327
|
return if @hide_this_step
|
329
|
-
|
328
|
+
|
330
329
|
@cell_type = @outline_row == 0 ? :th : :td
|
331
330
|
attributes = {:id => "#{@row_id}_#{@col_index}", :class => 'step'}
|
332
331
|
attributes[:class] += " #{status}" if status
|
@@ -339,10 +338,10 @@ module Cucumber
|
|
339
338
|
@delayed_messages << message
|
340
339
|
#@builder.pre(message, :class => 'message')
|
341
340
|
end
|
342
|
-
|
341
|
+
|
343
342
|
def print_messages
|
344
343
|
return if @delayed_messages.empty?
|
345
|
-
|
344
|
+
|
346
345
|
#@builder.ol do
|
347
346
|
@delayed_messages.each do |ann|
|
348
347
|
@builder.li(:class => 'step message') do
|
@@ -352,16 +351,16 @@ module Cucumber
|
|
352
351
|
#end
|
353
352
|
empty_messages
|
354
353
|
end
|
355
|
-
|
354
|
+
|
356
355
|
def print_table_row_messages
|
357
356
|
return if @delayed_messages.empty?
|
358
|
-
|
357
|
+
|
359
358
|
@builder.td(:class => 'message') do
|
360
359
|
@builder << @delayed_messages.join(", ")
|
361
360
|
end
|
362
361
|
empty_messages
|
363
362
|
end
|
364
|
-
|
363
|
+
|
365
364
|
def empty_messages
|
366
365
|
@delayed_messages = []
|
367
366
|
end
|
@@ -383,7 +382,7 @@ module Cucumber
|
|
383
382
|
message = "#{message} (#{exception.class})"
|
384
383
|
end
|
385
384
|
|
386
|
-
@builder.pre do
|
385
|
+
@builder.pre do
|
387
386
|
@builder.text!(message)
|
388
387
|
end
|
389
388
|
end
|
@@ -406,7 +405,7 @@ module Cucumber
|
|
406
405
|
set_scenario_color_failed
|
407
406
|
end
|
408
407
|
end
|
409
|
-
|
408
|
+
|
410
409
|
def set_scenario_color_failed
|
411
410
|
@builder.script do
|
412
411
|
@builder.text!("makeRed('cucumber-header');") unless @header_red
|
@@ -415,12 +414,12 @@ module Cucumber
|
|
415
414
|
@scenario_red = true
|
416
415
|
end
|
417
416
|
end
|
418
|
-
|
417
|
+
|
419
418
|
def set_scenario_color_pending
|
420
419
|
@builder.script do
|
421
420
|
@builder.text!("makeYellow('cucumber-header');") unless @header_red
|
422
421
|
@builder.text!("makeYellow('scenario_#{@scenario_number}');") unless @scenario_red
|
423
|
-
end
|
422
|
+
end
|
424
423
|
end
|
425
424
|
|
426
425
|
def get_step_count(features)
|
@@ -468,16 +467,16 @@ module Cucumber
|
|
468
467
|
@builder.span(keyword, :class => 'keyword')
|
469
468
|
@builder.span(:class => 'step val') do |name|
|
470
469
|
name << h(step_name).gsub(/<span class="(.*?)">/, '<span class="\1">').gsub(/<\/span>/, '</span>')
|
471
|
-
end
|
470
|
+
end
|
472
471
|
end
|
473
|
-
|
472
|
+
|
474
473
|
step_file = step_match.file_colon_line
|
475
474
|
step_file.gsub(/^([^:]*\.rb):(\d*)/) do
|
476
475
|
if ENV['TM_PROJECT_DIRECTORY']
|
477
476
|
step_file = "<a href=\"txmt://open?url=file://#{File.expand_path($1)}&line=#{$2}\">#{$1}:#{$2}</a> "
|
478
477
|
end
|
479
478
|
end
|
480
|
-
|
479
|
+
|
481
480
|
@builder.div(:class => 'step_file') do |div|
|
482
481
|
@builder.span do
|
483
482
|
@builder << step_file
|
@@ -509,29 +508,29 @@ module Cucumber
|
|
509
508
|
def inline_jquery
|
510
509
|
File.read(File.dirname(__FILE__) + '/jquery-min.js')
|
511
510
|
end
|
512
|
-
|
511
|
+
|
513
512
|
def inline_js_content
|
514
513
|
<<-EOF
|
515
514
|
|
516
515
|
SCENARIOS = "h3[id^='scenario_'],h3[id^=background_]";
|
517
|
-
|
516
|
+
|
518
517
|
$(document).ready(function() {
|
519
518
|
$(SCENARIOS).css('cursor', 'pointer');
|
520
519
|
$(SCENARIOS).click(function() {
|
521
520
|
$(this).siblings().toggle(250);
|
522
521
|
});
|
523
|
-
|
522
|
+
|
524
523
|
$("#collapser").css('cursor', 'pointer');
|
525
524
|
$("#collapser").click(function() {
|
526
525
|
$(SCENARIOS).siblings().hide();
|
527
526
|
});
|
528
|
-
|
527
|
+
|
529
528
|
$("#expander").css('cursor', 'pointer');
|
530
529
|
$("#expander").click(function() {
|
531
530
|
$(SCENARIOS).siblings().show();
|
532
531
|
});
|
533
532
|
})
|
534
|
-
|
533
|
+
|
535
534
|
function moveProgressBar(percentDone) {
|
536
535
|
$("cucumber-header").css('width', percentDone +"%");
|
537
536
|
}
|
@@ -543,7 +542,7 @@ module Cucumber
|
|
543
542
|
$('#'+element_id).css('background', '#FAF834');
|
544
543
|
$('#'+element_id).css('color', '#000000');
|
545
544
|
}
|
546
|
-
|
545
|
+
|
547
546
|
EOF
|
548
547
|
end
|
549
548
|
|
@@ -580,12 +579,12 @@ module Cucumber
|
|
580
579
|
|
581
580
|
def print_stat_string(features)
|
582
581
|
string = String.new
|
583
|
-
string << dump_count(@
|
584
|
-
scenario_count = print_status_counts{|status| @
|
582
|
+
string << dump_count(@runtime.scenarios.length, "scenario")
|
583
|
+
scenario_count = print_status_counts{|status| @runtime.scenarios(status)}
|
585
584
|
string << scenario_count if scenario_count
|
586
585
|
string << "<br />"
|
587
|
-
string << dump_count(@
|
588
|
-
step_count = print_status_counts{|status| @
|
586
|
+
string << dump_count(@runtime.steps.length, "step")
|
587
|
+
step_count = print_status_counts{|status| @runtime.steps(status)}
|
589
588
|
string << step_count if step_count
|
590
589
|
end
|
591
590
|
|