kosmas58-cucumber 0.1.99.23 → 0.1.100.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -23
- data/Manifest.txt +14 -2
- data/examples/i18n/en-lol/Rakefile +6 -0
- data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +16 -0
- data/examples/i18n/en-lol/features/stuffing.feature +8 -0
- data/examples/i18n/en-lol/features/support/env.rb +8 -0
- data/examples/i18n/en-lol/lib/basket.rb +12 -0
- data/examples/i18n/en-lol/lib/belly.rb +11 -0
- data/examples/i18n/et/features/jagamine.feature +9 -0
- data/examples/jbehave/README.textile +4 -1
- data/examples/jbehave/features/trading.feature +4 -0
- data/examples/jbehave/pom.xml +5 -0
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +6 -1
- data/examples/selenium/features/step_definitons/search_steps.rb +13 -0
- data/examples/selenium/features/support/env.rb +19 -0
- data/examples/selenium_webrat/Rakefile +6 -0
- data/examples/selenium_webrat/features/search.feature +9 -0
- data/examples/selenium_webrat/features/step_definitons/search_steps.rb +13 -0
- data/examples/selenium_webrat/features/support/env.rb +41 -0
- data/examples/self_test/Rakefile +1 -1
- data/examples/self_test/features/background/failing_background.feature +1 -0
- data/examples/self_test/features/step_definitions/sample_steps.rb +1 -1
- data/examples/self_test/features/support/tag_count_formatter.rb +1 -1
- data/examples/tickets/Rakefile +13 -8
- data/examples/tickets/cucumber.yml +2 -1
- data/examples/tickets/features/236.feature +13 -0
- data/examples/tickets/features/241.feature +13 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +17 -4
- data/examples/tickets/features/tickets.feature +1 -1
- data/features/background.feature +9 -11
- data/features/cucumber_cli.feature +24 -1
- data/features/cucumber_cli_outlines.feature +10 -19
- data/features/report_called_undefined_steps.feature +2 -0
- data/gem_tasks/rspec.rake +3 -2
- data/lib/cucumber.rb +7 -15
- data/lib/cucumber/ast.rb +3 -3
- data/lib/cucumber/ast/background.rb +28 -66
- data/lib/cucumber/ast/examples.rb +15 -3
- data/lib/cucumber/ast/feature.rb +20 -24
- data/lib/cucumber/ast/feature_element.rb +46 -0
- data/lib/cucumber/ast/features.rb +2 -21
- data/lib/cucumber/ast/outline_table.rb +46 -14
- data/lib/cucumber/ast/py_string.rb +9 -3
- data/lib/cucumber/ast/scenario.rb +34 -73
- data/lib/cucumber/ast/scenario_outline.rb +40 -42
- data/lib/cucumber/ast/step.rb +51 -90
- data/lib/cucumber/ast/step_collection.rb +66 -0
- data/lib/cucumber/ast/step_invocation.rb +110 -0
- data/lib/cucumber/ast/table.rb +41 -21
- data/lib/cucumber/ast/tags.rb +4 -11
- data/lib/cucumber/ast/visitor.rb +35 -19
- data/lib/cucumber/broadcaster.rb +1 -3
- data/lib/cucumber/cli/configuration.rb +25 -17
- data/lib/cucumber/cli/language_help_formatter.rb +4 -4
- data/lib/cucumber/cli/main.rb +6 -4
- data/lib/cucumber/core_ext/proc.rb +2 -2
- data/lib/cucumber/formatter/ansicolor.rb +0 -1
- data/lib/cucumber/formatter/console.rb +24 -34
- data/lib/cucumber/formatter/html.rb +18 -11
- data/lib/cucumber/formatter/pretty.rb +48 -36
- data/lib/cucumber/formatter/profile.rb +6 -6
- data/lib/cucumber/formatter/progress.rb +14 -22
- data/lib/cucumber/formatter/rerun.rb +6 -6
- data/lib/cucumber/jbehave.rb +21 -26
- data/lib/cucumber/languages.yml +17 -2
- data/lib/cucumber/parser/feature.rb +26 -29
- data/lib/cucumber/parser/feature.tt +17 -12
- data/lib/cucumber/parser/treetop_ext.rb +13 -13
- data/lib/cucumber/platform.rb +0 -1
- data/lib/cucumber/rails/world.rb +2 -2
- data/lib/cucumber/rake/task.rb +1 -2
- data/lib/cucumber/step_definition.rb +21 -12
- data/lib/cucumber/step_match.rb +49 -0
- data/lib/cucumber/step_mother.rb +100 -80
- data/lib/cucumber/version.rb +2 -2
- data/lib/cucumber/world.rb +53 -0
- data/rails_generators/cucumber/templates/paths.rb +1 -1
- data/rails_generators/cucumber/templates/webrat_steps.rb +17 -17
- data/rails_generators/feature/feature_generator.rb +5 -1
- data/rails_generators/feature/templates/steps.erb +0 -4
- data/spec/cucumber/ast/background_spec.rb +32 -41
- data/spec/cucumber/ast/feature_factory.rb +10 -1
- data/spec/cucumber/ast/feature_spec.rb +7 -30
- data/spec/cucumber/ast/py_string_spec.rb +7 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +3 -0
- data/spec/cucumber/ast/scenario_spec.rb +8 -25
- data/spec/cucumber/ast/step_collection_spec.rb +8 -0
- data/spec/cucumber/ast/step_spec.rb +49 -28
- data/spec/cucumber/ast/table_spec.rb +13 -3
- data/spec/cucumber/ast/tags_spec.rb +2 -18
- data/spec/cucumber/broadcaster_spec.rb +6 -5
- data/spec/cucumber/cli/configuration_spec.rb +7 -0
- data/spec/cucumber/cli/main_spec.rb +1 -1
- data/spec/cucumber/parser/feature_parser_spec.rb +6 -5
- data/spec/cucumber/step_definition_spec.rb +16 -5
- data/spec/cucumber/step_mother_spec.rb +6 -6
- data/spec/cucumber/world/pending_spec.rb +1 -1
- metadata +24 -5
- data/lib/cucumber/ast/filter.rb +0 -22
- data/lib/cucumber/ast/steps.rb +0 -13
data/lib/cucumber/ast/feature.rb
CHANGED
@@ -5,23 +5,13 @@ module Cucumber
|
|
5
5
|
attr_accessor :file
|
6
6
|
attr_writer :features, :lines
|
7
7
|
|
8
|
-
def initialize(comment, tags, name, feature_elements
|
9
|
-
@comment, @tags, @name, @feature_elements
|
10
|
-
feature_elements.each do |feature_element|
|
11
|
-
feature_element.feature = self
|
12
|
-
feature_element.background = background if background
|
13
|
-
end
|
14
|
-
background.feature = self if background
|
8
|
+
def initialize(background, comment, tags, name, feature_elements)
|
9
|
+
@background, @comment, @tags, @name, @feature_elements = background, comment, tags, name, feature_elements
|
15
10
|
@lines = []
|
16
|
-
end
|
17
11
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def matches_scenario_names?(scenario_names)
|
24
|
-
@feature_elements.detect{|e| e.matches_scenario_names?(scenario_names)}
|
12
|
+
@feature_elements.each do |feature_element|
|
13
|
+
feature_element.feature = self
|
14
|
+
end
|
25
15
|
end
|
26
16
|
|
27
17
|
def accept(visitor)
|
@@ -29,25 +19,31 @@ module Cucumber
|
|
29
19
|
visitor.visit_comment(@comment)
|
30
20
|
visitor.visit_tags(@tags)
|
31
21
|
visitor.visit_feature_name(@name)
|
32
|
-
|
22
|
+
visitor.visit_background(@background) if @background
|
33
23
|
@feature_elements.each do |feature_element|
|
34
|
-
visitor.visit_feature_element(feature_element) if
|
24
|
+
visitor.visit_feature_element(feature_element) if feature_element.descend?(visitor)
|
35
25
|
end
|
36
26
|
end
|
37
27
|
|
38
|
-
def
|
39
|
-
@
|
28
|
+
def descend?(visitor)
|
29
|
+
@feature_elements.detect{ |feature_element| feature_element.descend?(visitor) }
|
30
|
+
end
|
31
|
+
|
32
|
+
def has_tags?(tags)
|
33
|
+
@tags.has_tags?(tags)
|
40
34
|
end
|
41
35
|
|
42
|
-
def
|
43
|
-
@
|
36
|
+
def next_feature_element(feature_element, &proc)
|
37
|
+
index = @feature_elements.index(feature_element)
|
38
|
+
next_one = @feature_elements[index+1]
|
39
|
+
proc.call(next_one) if next_one
|
44
40
|
end
|
45
41
|
|
46
42
|
def backtrace_line(step_name, line)
|
47
|
-
"#{
|
43
|
+
"#{file_colon_line(line)}:in `#{step_name}'"
|
48
44
|
end
|
49
45
|
|
50
|
-
def
|
46
|
+
def file_colon_line(line)
|
51
47
|
"#{@file}:#{line}"
|
52
48
|
end
|
53
49
|
|
@@ -58,7 +54,7 @@ module Cucumber
|
|
58
54
|
tags = @tags.to_sexp
|
59
55
|
sexp += tags if tags.any?
|
60
56
|
sexp += [@background.to_sexp] if @background
|
61
|
-
sexp += @feature_elements.map{|
|
57
|
+
sexp += @feature_elements.map{|fe| fe.to_sexp}
|
62
58
|
sexp
|
63
59
|
end
|
64
60
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module FeatureElement
|
3
|
+
def attach_steps(steps)
|
4
|
+
steps.each {|step| step.feature_element = self}
|
5
|
+
end
|
6
|
+
|
7
|
+
def file_colon_line(line = @line)
|
8
|
+
@feature.file_colon_line(line) if @feature
|
9
|
+
end
|
10
|
+
|
11
|
+
def text_length
|
12
|
+
@keyword.jlength + @name.jlength
|
13
|
+
end
|
14
|
+
|
15
|
+
def matches_lines?(lines)
|
16
|
+
lines.index(@line) || @steps.matches_lines?(lines) || @tags.matches_lines?(lines)
|
17
|
+
end
|
18
|
+
|
19
|
+
def has_tags?(tags)
|
20
|
+
@tags.has_tags?(tags) || @feature.has_tags?(tags)
|
21
|
+
end
|
22
|
+
|
23
|
+
def matches_scenario_names?(scenario_names)
|
24
|
+
scenario_names.detect{|name| name == @name}
|
25
|
+
end
|
26
|
+
|
27
|
+
def backtrace_line(name = "#{@keyword} #{@name}", line = @line)
|
28
|
+
@feature.backtrace_line(name, line) if @feature
|
29
|
+
end
|
30
|
+
|
31
|
+
def source_indent(text_length)
|
32
|
+
max_line_length - text_length
|
33
|
+
end
|
34
|
+
|
35
|
+
def max_line_length
|
36
|
+
@steps.max_line_length(self)
|
37
|
+
end
|
38
|
+
|
39
|
+
# TODO: Remove when we use StepCollection everywhere
|
40
|
+
def previous_step(step)
|
41
|
+
i = @steps.index(step) || -1
|
42
|
+
@steps[i-1]
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -1,14 +1,8 @@
|
|
1
1
|
module Cucumber
|
2
2
|
module Ast
|
3
3
|
class Features
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(filter)
|
7
|
-
@filter = filter
|
8
|
-
|
4
|
+
def initialize
|
9
5
|
@features = []
|
10
|
-
@scenarios = []
|
11
|
-
@steps = Hash.new{|steps, status| steps[status] = []}
|
12
6
|
end
|
13
7
|
|
14
8
|
def add_feature(feature)
|
@@ -16,22 +10,9 @@ module Cucumber
|
|
16
10
|
@features << feature
|
17
11
|
end
|
18
12
|
|
19
|
-
def visit?(node, lines)
|
20
|
-
@filter.matched?(node) &&
|
21
|
-
(lines.empty? ? true : node.at_lines?(lines))
|
22
|
-
end
|
23
|
-
|
24
|
-
def scenario_executed(scenario)
|
25
|
-
@scenarios << scenario
|
26
|
-
end
|
27
|
-
|
28
|
-
def step_executed(step)
|
29
|
-
@steps[step.status] << step
|
30
|
-
end
|
31
|
-
|
32
13
|
def accept(visitor)
|
33
14
|
@features.each do |feature|
|
34
|
-
visitor.visit_feature(feature) if
|
15
|
+
visitor.visit_feature(feature) if feature.descend?(visitor)
|
35
16
|
end
|
36
17
|
end
|
37
18
|
end
|
@@ -5,35 +5,67 @@ module Cucumber
|
|
5
5
|
super(raw)
|
6
6
|
@scenario_outline = scenario_outline
|
7
7
|
@cells_class = ExampleCells
|
8
|
+
|
9
|
+
cells_rows.each do |cells|
|
10
|
+
cells.create_step_invocations!(scenario_outline)
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
|
-
def accept(visitor
|
14
|
+
def accept(visitor)
|
11
15
|
cells_rows.each_with_index do |row, n|
|
12
|
-
|
13
|
-
|
14
|
-
@scenario_outline.at_header_or_step_lines?(visitor.current_feature_lines)
|
15
|
-
|
16
|
-
if should_visit
|
17
|
-
visitor.visit_table_row(row, status)
|
16
|
+
if n == 0 || matches?(visitor, row)
|
17
|
+
visitor.visit_table_row(row)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
nil
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def descend?(visitor)
|
24
|
+
cells_rows.detect{|cells_row| cells_row.descend?(visitor)}
|
25
|
+
end
|
26
|
+
|
27
|
+
def matches?(visitor, cells)
|
28
|
+
@scenario_outline.matches_tags_and_name?(visitor) &&
|
29
|
+
(visitor.matches_lines?(cells) || visitor.matches_lines?(@scenario_outline))
|
30
|
+
end
|
31
|
+
|
32
|
+
def skip_invoke!
|
33
|
+
cells_rows.each do |cells|
|
34
|
+
cells.skip_invoke!
|
35
|
+
end
|
25
36
|
end
|
26
37
|
|
27
38
|
class ExampleCells < Cells
|
28
|
-
def
|
39
|
+
def create_step_invocations!(scenario_outline)
|
40
|
+
@step_invocations = scenario_outline.step_invocations(self)
|
41
|
+
end
|
42
|
+
|
43
|
+
def descend?(visitor)
|
44
|
+
@table.matches?(visitor, self)
|
45
|
+
end
|
46
|
+
|
47
|
+
def skip_invoke!
|
48
|
+
@step_invocations.each do |step_invocation|
|
49
|
+
step_invocation.skip_invoke!
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def accept(visitor)
|
29
54
|
if header?
|
30
55
|
@cells.each do |cell|
|
31
|
-
|
56
|
+
cell.status = :skipped
|
57
|
+
visitor.visit_table_cell(cell)
|
32
58
|
end
|
33
|
-
nil
|
34
59
|
else
|
35
|
-
|
36
|
-
|
60
|
+
visitor.step_mother.before_and_after(self) do
|
61
|
+
@step_invocations.each do |step_invocation|
|
62
|
+
step_invocation.invoke(visitor.step_mother, visitor.options)
|
63
|
+
@exception ||= step_invocation.exception
|
64
|
+
end
|
65
|
+
|
66
|
+
@cells.each do |cell|
|
67
|
+
visitor.visit_table_cell(cell)
|
68
|
+
end
|
37
69
|
end
|
38
70
|
end
|
39
71
|
end
|
@@ -20,23 +20,29 @@ module Cucumber
|
|
20
20
|
def initialize(start_line, end_line, string, quotes_indent)
|
21
21
|
@start_line, @end_line = start_line, end_line
|
22
22
|
@string, @quotes_indent = string.gsub(/\\"/, '"'), quotes_indent
|
23
|
+
@status = :passed
|
24
|
+
end
|
25
|
+
|
26
|
+
def status=(status)
|
27
|
+
@status = status
|
23
28
|
end
|
24
29
|
|
25
30
|
def to_s
|
26
31
|
@string.indent(-@quotes_indent)
|
27
32
|
end
|
28
33
|
|
29
|
-
def
|
34
|
+
def matches_lines?(lines)
|
30
35
|
lines.detect{|l| l >= @start_line && l <= @end_line}
|
31
36
|
end
|
32
37
|
|
33
|
-
def accept(visitor
|
34
|
-
visitor.visit_py_string(to_s, status)
|
38
|
+
def accept(visitor)
|
39
|
+
visitor.visit_py_string(to_s, @status)
|
35
40
|
end
|
36
41
|
|
37
42
|
def arguments_replaced(arguments) #:nodoc:
|
38
43
|
string = @string
|
39
44
|
arguments.each do |name, value|
|
45
|
+
value ||= ''
|
40
46
|
string = string.gsub(name, value)
|
41
47
|
end
|
42
48
|
PyString.new(@start_line, @end_line, string, @quotes_indent)
|
@@ -1,91 +1,51 @@
|
|
1
|
+
require 'cucumber/ast/feature_element'
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Ast
|
3
5
|
class Scenario
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(comment, tags, line, keyword, name, steps)
|
7
|
-
@comment, @tags, @line, @keyword, @name = comment, tags, line, keyword, name
|
8
|
-
steps
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
include FeatureElement
|
7
|
+
|
8
|
+
def initialize(background, comment, tags, line, keyword, name, steps)
|
9
|
+
@background, @comment, @tags, @line, @keyword, @name = background, comment, tags, line, keyword, name
|
10
|
+
attach_steps(steps)
|
11
|
+
|
12
|
+
step_invocations = steps.map{|step| step.step_invocation}
|
13
|
+
if @background
|
14
|
+
@steps = @background.step_collection(step_invocations)
|
15
|
+
else
|
16
|
+
@steps = StepCollection.new(step_invocations)
|
17
|
+
end
|
15
18
|
end
|
16
19
|
|
17
|
-
def
|
18
|
-
@
|
20
|
+
def feature=(feature)
|
21
|
+
@feature = feature
|
22
|
+
@background.feature = feature if @background
|
19
23
|
end
|
20
24
|
|
21
|
-
def
|
22
|
-
|
25
|
+
def descend?(visitor)
|
26
|
+
visitor.matches_lines?(self) &&
|
27
|
+
visitor.included_by_tags?(self) &&
|
28
|
+
!visitor.excluded_by_tags?(self) &&
|
29
|
+
visitor.matches_scenario_names?(self)
|
23
30
|
end
|
24
31
|
|
25
32
|
def accept(visitor)
|
26
|
-
visitor.visit_background(@background) if @background
|
27
33
|
visitor.visit_comment(@comment)
|
28
34
|
visitor.visit_tags(@tags)
|
29
|
-
visitor.visit_scenario_name(@keyword, @name,
|
30
|
-
visitor.visit_steps(@steps_helper)
|
31
|
-
|
32
|
-
@feature.scenario_executed(self) if @feature && !@executed
|
33
|
-
@executed = true
|
34
|
-
end
|
35
|
+
visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(text_length))
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
visitor.
|
39
|
-
|
40
|
-
@steps.each do |step|
|
41
|
-
step.previous = previous
|
42
|
-
step.world = world
|
43
|
-
visitor.visit_step(step)
|
44
|
-
previous = step.status
|
45
|
-
end
|
37
|
+
skip = @background && @background.failed?
|
38
|
+
skip_invoke! if skip
|
39
|
+
visitor.step_mother.before_and_after(self, skip) do
|
40
|
+
visitor.visit_steps(@steps)
|
46
41
|
end
|
47
42
|
end
|
48
43
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
lengths = (@steps + [self]).map{|e| e.text_length}
|
55
|
-
lengths.max
|
56
|
-
end
|
57
|
-
|
58
|
-
def text_length
|
59
|
-
@keyword.jlength + @name.jlength
|
60
|
-
end
|
61
|
-
|
62
|
-
def at_lines?(lines)
|
63
|
-
at_header_or_step_lines?(lines)
|
64
|
-
end
|
65
|
-
|
66
|
-
def at_header_or_step_lines?(lines)
|
67
|
-
lines.empty? || lines.index(@line) || @steps.detect {|step| step.at_lines?(lines)} || @tags.at_lines?(lines)
|
68
|
-
end
|
69
|
-
|
70
|
-
def undefined?
|
71
|
-
@steps.empty?
|
72
|
-
end
|
73
|
-
|
74
|
-
def step_executed(step)
|
75
|
-
@feature.step_executed(step) if @feature
|
76
|
-
end
|
77
|
-
|
78
|
-
def backtrace_line(name = "#{@keyword} #{@name}", line = @line)
|
79
|
-
@feature.backtrace_line(name, line) if @feature
|
80
|
-
end
|
81
|
-
|
82
|
-
def file_line(line = @line)
|
83
|
-
@feature.file_line(line) if @feature
|
84
|
-
end
|
85
|
-
|
86
|
-
def previous_step(step)
|
87
|
-
i = @steps.index(step) || -1
|
88
|
-
@steps[i-1]
|
44
|
+
def skip_invoke!
|
45
|
+
@steps.each{|step_invocation| step_invocation.skip_invoke!}
|
46
|
+
@feature.next_feature_element(self) do |next_one|
|
47
|
+
next_one.skip_invoke!
|
48
|
+
end
|
89
49
|
end
|
90
50
|
|
91
51
|
def to_sexp
|
@@ -94,10 +54,11 @@ module Cucumber
|
|
94
54
|
sexp += [comment] if comment
|
95
55
|
tags = @tags.to_sexp
|
96
56
|
sexp += tags if tags.any?
|
97
|
-
steps = @steps.
|
57
|
+
steps = @steps.to_sexp
|
98
58
|
sexp += steps if steps.any?
|
99
59
|
sexp
|
100
60
|
end
|
61
|
+
|
101
62
|
end
|
102
63
|
end
|
103
64
|
end
|
@@ -1,15 +1,18 @@
|
|
1
1
|
module Cucumber
|
2
2
|
module Ast
|
3
|
-
class ScenarioOutline
|
3
|
+
class ScenarioOutline
|
4
|
+
include FeatureElement
|
5
|
+
|
4
6
|
# The +example_sections+ argument must be an Array where each element is another array representing
|
5
7
|
# an Examples section. This array has 3 elements:
|
6
8
|
#
|
7
9
|
# * Examples keyword
|
8
10
|
# * Examples section name
|
9
11
|
# * Raw matrix
|
10
|
-
def initialize(comment, tags, line, keyword, name, steps, example_sections)
|
11
|
-
|
12
|
-
steps
|
12
|
+
def initialize(background, comment, tags, line, keyword, name, steps, example_sections)
|
13
|
+
@background, @comment, @tags, @line, @keyword, @name = background, comment, tags, line, keyword, name
|
14
|
+
attach_steps(steps)
|
15
|
+
@steps = StepCollection.new(steps)
|
13
16
|
|
14
17
|
@examples_array = example_sections.map do |example_section|
|
15
18
|
examples_line = example_section[0]
|
@@ -22,59 +25,54 @@ module Cucumber
|
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
25
|
-
def
|
26
|
-
|
28
|
+
def feature=(feature)
|
29
|
+
@feature = feature
|
30
|
+
@background.feature = feature if @background
|
31
|
+
end
|
32
|
+
|
33
|
+
def descend?(visitor)
|
34
|
+
@examples_array.detect { |examples| examples.descend?(visitor) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def matches_tags_and_name?(visitor)
|
38
|
+
visitor.included_by_tags?(self) &&
|
39
|
+
!visitor.excluded_by_tags?(self) &&
|
40
|
+
visitor.matches_scenario_names?(self)
|
27
41
|
end
|
28
42
|
|
29
43
|
def accept(visitor)
|
30
|
-
visitor.visit_background(@background) if @background
|
31
44
|
visitor.visit_comment(@comment)
|
32
45
|
visitor.visit_tags(@tags)
|
33
|
-
visitor.visit_scenario_name(@keyword, @name,
|
34
|
-
visitor.visit_steps(@
|
46
|
+
visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(text_length))
|
47
|
+
visitor.visit_steps(@steps)
|
35
48
|
|
49
|
+
skip_invoke! if @background && @background.failed?
|
36
50
|
@examples_array.each do |examples|
|
37
|
-
visitor.visit_examples(examples)
|
51
|
+
visitor.visit_examples(examples) if examples.descend?(visitor)
|
38
52
|
end
|
39
53
|
end
|
40
54
|
|
41
|
-
def
|
42
|
-
@examples_array.each
|
43
|
-
|
55
|
+
def skip_invoke!
|
56
|
+
@examples_array.each{|examples| examples.skip_invoke!}
|
57
|
+
@feature.next_feature_element(self) do |next_one|
|
58
|
+
next_one.skip_invoke!
|
44
59
|
end
|
45
60
|
end
|
46
61
|
|
47
|
-
def
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
previous_status = @background ? @background.status : :passed
|
54
|
-
argument_hash = cells.to_hash
|
55
|
-
cell_index = 0
|
56
|
-
@steps.each do |step|
|
57
|
-
executed_step, previous_status, matched_args =
|
58
|
-
step.execute_with_arguments(argument_hash, world, previous_status, visitor, cells[0].line)
|
59
|
-
# There might be steps that don't have any arguments
|
60
|
-
# If there are no matched args, we'll still iterate once
|
61
|
-
matched_args = [nil] if matched_args.empty?
|
62
|
-
|
63
|
-
matched_args.each do
|
64
|
-
cell = cells[cell_index]
|
65
|
-
if cell
|
66
|
-
proc.call(cell, previous_status)
|
67
|
-
cell_index += 1
|
68
|
-
end
|
69
|
-
end
|
70
|
-
exception ||= executed_step.exception
|
71
|
-
end
|
62
|
+
def step_invocations(cells)
|
63
|
+
step_invocations = @steps.step_invocations_from_cells(cells)
|
64
|
+
if @background
|
65
|
+
@background.step_collection(step_invocations)
|
66
|
+
else
|
67
|
+
StepCollection.new(step_invocations)
|
72
68
|
end
|
73
|
-
@feature.scenario_executed(self) if @feature
|
74
|
-
exception
|
75
69
|
end
|
76
70
|
|
77
|
-
def
|
71
|
+
def each_example_row(&proc)
|
72
|
+
@examples_array.each do |examples|
|
73
|
+
examples.each_example_row(&proc)
|
74
|
+
end
|
75
|
+
end
|
78
76
|
|
79
77
|
def to_sexp
|
80
78
|
sexp = [:scenario_outline, @keyword, @name]
|
@@ -82,7 +80,7 @@ module Cucumber
|
|
82
80
|
sexp += [comment] if comment
|
83
81
|
tags = @tags.to_sexp
|
84
82
|
sexp += tags if tags.any?
|
85
|
-
steps = @steps.
|
83
|
+
steps = @steps.to_sexp
|
86
84
|
sexp += steps if steps.any?
|
87
85
|
sexp += @examples_array.map{|e| e.to_sexp}
|
88
86
|
sexp
|