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/step.rb
CHANGED
@@ -4,63 +4,66 @@ require 'cucumber/core_ext/string'
|
|
4
4
|
module Cucumber
|
5
5
|
module Ast
|
6
6
|
class Step
|
7
|
-
attr_reader :keyword, :name
|
8
|
-
attr_writer :
|
9
|
-
attr_accessor :
|
7
|
+
attr_reader :line, :keyword, :name, :multiline_arg
|
8
|
+
attr_writer :step_collection, :options
|
9
|
+
attr_accessor :feature_element, :exception
|
10
10
|
|
11
|
-
def initialize(line, keyword, name,
|
12
|
-
@line, @keyword, @name, @
|
11
|
+
def initialize(line, keyword, name, multiline_arg=nil)
|
12
|
+
@line, @keyword, @name, @multiline_arg = line, keyword, name, multiline_arg
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
|
17
|
-
|
18
|
-
multiline_args = replace_multiline_args_arguments(delimited_arguments)
|
15
|
+
def background?
|
16
|
+
false
|
17
|
+
end
|
19
18
|
|
20
|
-
|
19
|
+
def step_invocation
|
20
|
+
StepInvocation.new(self, @name, @multiline_arg, [])
|
21
21
|
end
|
22
|
-
|
23
|
-
def
|
24
|
-
|
22
|
+
|
23
|
+
def step_invocation_from_cells(cells)
|
24
|
+
matched_cells = matched_cells(cells)
|
25
|
+
|
26
|
+
delimited_arguments = delimit_argument_names(cells.to_hash)
|
27
|
+
name = replace_name_arguments(delimited_arguments)
|
28
|
+
multiline_arg = @multiline_arg.nil? ? nil : @multiline_arg.arguments_replaced(delimited_arguments)
|
29
|
+
|
30
|
+
StepInvocation.new(self, name, multiline_arg, matched_cells)
|
25
31
|
end
|
26
32
|
|
27
33
|
def accept(visitor)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
visitor.
|
36
|
-
|
37
|
-
visitor.visit_multiline_arg(multiline_arg, @status)
|
38
|
-
end
|
39
|
-
@exception
|
34
|
+
# The only time a Step is visited is when it is in a ScenarioOutline.
|
35
|
+
# Otherwise it's always StepInvocation that gest visited instead.
|
36
|
+
visit_step_details(visitor, first_match(visitor), @multiline_arg, :skipped, nil, nil)
|
37
|
+
end
|
38
|
+
|
39
|
+
def visit_step_details(visitor, step_match, multiline_arg, status, exception, background)
|
40
|
+
visitor.visit_step_name(@keyword, step_match, status, source_indent, background)
|
41
|
+
visitor.visit_multiline_arg(@multiline_arg) if @multiline_arg
|
42
|
+
visitor.visit_exception(exception, status) if exception
|
40
43
|
end
|
41
44
|
|
42
|
-
def
|
43
|
-
# @
|
44
|
-
@
|
45
|
+
def first_match(visitor)
|
46
|
+
# @feature_element is always a ScenarioOutline in this case
|
47
|
+
@feature_element.each_example_row do |cells|
|
45
48
|
argument_hash = cells.to_hash
|
46
49
|
delimited_arguments = delimit_argument_names(argument_hash)
|
47
50
|
name = replace_name_arguments(delimited_arguments)
|
48
|
-
|
49
|
-
return
|
51
|
+
step_match = visitor.step_mother.step_match(name, @name) rescue nil
|
52
|
+
return step_match if step_match
|
50
53
|
end
|
51
|
-
|
54
|
+
NoStepMatch.new(self)
|
52
55
|
end
|
53
56
|
|
54
57
|
def to_sexp
|
55
|
-
[:step, @line, @keyword, @name,
|
58
|
+
[:step, @line, @keyword, @name, (@multiline_arg.nil? ? nil : @multiline_arg.to_sexp)].compact
|
56
59
|
end
|
57
60
|
|
58
|
-
def
|
59
|
-
lines.
|
61
|
+
def matches_lines?(lines)
|
62
|
+
lines.index(@line) || (@multiline_arg && @multiline_arg.matches_lines?(lines))
|
60
63
|
end
|
61
64
|
|
62
65
|
def source_indent
|
63
|
-
@
|
66
|
+
@feature_element.source_indent(text_length)
|
64
67
|
end
|
65
68
|
|
66
69
|
def text_length
|
@@ -68,11 +71,11 @@ module Cucumber
|
|
68
71
|
end
|
69
72
|
|
70
73
|
def backtrace_line
|
71
|
-
@backtrace_line ||= @
|
74
|
+
@backtrace_line ||= @feature_element.backtrace_line("#{@keyword} #{@name}", @line) unless @feature_element.nil?
|
72
75
|
end
|
73
76
|
|
74
|
-
def
|
75
|
-
@
|
77
|
+
def file_colon_line
|
78
|
+
@file_colon_line ||= @feature_element.file_colon_line(@line) unless @feature_element.nil?
|
76
79
|
end
|
77
80
|
|
78
81
|
def actual_keyword
|
@@ -85,77 +88,35 @@ module Cucumber
|
|
85
88
|
|
86
89
|
protected
|
87
90
|
|
91
|
+
# TODO: Remove when we use StepCollection everywhere
|
88
92
|
def previous_step
|
89
|
-
@
|
93
|
+
@feature_element.previous_step(self)
|
90
94
|
end
|
91
95
|
|
92
96
|
private
|
93
97
|
|
94
|
-
def
|
95
|
-
|
96
|
-
|
97
|
-
begin
|
98
|
-
@step_definition = visitor.step_definition(@name)
|
99
|
-
matched_args = @step_definition.matched_args(@name)
|
100
|
-
if @previous == :passed && !visitor.options[:dry_run]
|
101
|
-
@world.__cucumber_current_step = self
|
102
|
-
@step_definition.execute(@name, @world, *(matched_args + @multiline_args))
|
103
|
-
@status = :passed
|
104
|
-
else
|
105
|
-
@status = :skipped
|
106
|
-
end
|
107
|
-
rescue Undefined => exception
|
108
|
-
if visitor.options[:strict]
|
109
|
-
exception.set_backtrace([])
|
110
|
-
failed(exception)
|
111
|
-
else
|
112
|
-
@status = :undefined
|
113
|
-
end
|
114
|
-
rescue Pending => exception
|
115
|
-
visitor.options[:strict] ? failed(exception) : @status = :pending
|
116
|
-
rescue Exception => exception
|
117
|
-
failed(exception)
|
118
|
-
end
|
119
|
-
@scenario.step_executed(self) if @scenario
|
98
|
+
def matched_cells(cells)
|
99
|
+
cells.select do |cell|
|
100
|
+
@name.index(delimited(cell.header_cell.value))
|
120
101
|
end
|
121
|
-
[self, @status, matched_args]
|
122
102
|
end
|
123
103
|
|
124
|
-
def
|
125
|
-
|
126
|
-
step = Step.new(line, @keyword, name, *multiline_args)
|
127
|
-
step.scenario = @scenario
|
128
|
-
step.world = world
|
129
|
-
step.previous = previous
|
130
|
-
step.__send__(:execute, visitor)
|
104
|
+
def delimit_argument_names(argument_hash)
|
105
|
+
argument_hash.inject({}) { |h,(name,value)| h[delimited(name)] = value; h }
|
131
106
|
end
|
132
107
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
def delimit_argument_names(argument_hash)
|
137
|
-
argument_hash.inject({}) { |h,(k,v)| h["#{ARGUMENT_START}#{k}#{ARGUMENT_END}"] = v; h }
|
108
|
+
def delimited(s)
|
109
|
+
"<#{s}>"
|
138
110
|
end
|
139
111
|
|
140
112
|
def replace_name_arguments(argument_hash)
|
141
113
|
name_with_arguments_replaced = @name
|
142
114
|
argument_hash.each do |name, value|
|
115
|
+
value ||= ''
|
143
116
|
name_with_arguments_replaced = name_with_arguments_replaced.gsub(name, value) if value
|
144
117
|
end
|
145
118
|
name_with_arguments_replaced
|
146
119
|
end
|
147
|
-
|
148
|
-
def replace_multiline_args_arguments(arguments)
|
149
|
-
@multiline_args.map do |arg|
|
150
|
-
arg.arguments_replaced(arguments)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
def failed(exception)
|
155
|
-
@status = :failed
|
156
|
-
@exception = exception
|
157
|
-
@exception.backtrace << backtrace_line unless backtrace_line.nil?
|
158
|
-
end
|
159
120
|
end
|
160
121
|
end
|
161
122
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Ast
|
3
|
+
# Holds an Array of Step or StepDefinition
|
4
|
+
class StepCollection
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
def initialize(steps)
|
8
|
+
@steps = steps
|
9
|
+
@steps.each{|step| step.step_collection = self}
|
10
|
+
end
|
11
|
+
|
12
|
+
def accept(visitor, &proc)
|
13
|
+
@steps.each do |step|
|
14
|
+
visitor.visit_step(step) if proc.nil? || proc.call(step)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def step_invocations(background = false)
|
19
|
+
StepCollection.new(@steps.map{ |step|
|
20
|
+
i = step.step_invocation
|
21
|
+
i.background = background
|
22
|
+
i
|
23
|
+
})
|
24
|
+
end
|
25
|
+
|
26
|
+
def step_invocations_from_cells(cells)
|
27
|
+
@steps.map{|step| step.step_invocation_from_cells(cells)}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Duplicates this instance and adds +step_invocations+ to the end
|
31
|
+
def dup(step_invocations = [])
|
32
|
+
StepCollection.new(@steps + step_invocations)
|
33
|
+
end
|
34
|
+
|
35
|
+
def each(&proc)
|
36
|
+
@steps.each(&proc)
|
37
|
+
end
|
38
|
+
|
39
|
+
def previous_step(step)
|
40
|
+
i = @steps.index(step) || -1
|
41
|
+
@steps[i-1]
|
42
|
+
end
|
43
|
+
|
44
|
+
def matches_lines?(lines)
|
45
|
+
@steps.detect {|step| step.matches_lines?(lines)}
|
46
|
+
end
|
47
|
+
|
48
|
+
def empty?
|
49
|
+
@steps.empty?
|
50
|
+
end
|
51
|
+
|
52
|
+
def max_line_length(feature_element)
|
53
|
+
lengths = (@steps + [feature_element]).map{|e| e.text_length}
|
54
|
+
lengths.max
|
55
|
+
end
|
56
|
+
|
57
|
+
def exception
|
58
|
+
@exception ||= ((failed = @steps.detect {|step| step.exception}) && failed.exception)
|
59
|
+
end
|
60
|
+
|
61
|
+
def to_sexp
|
62
|
+
@steps.map{|step| step.to_sexp}
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Ast
|
3
|
+
class StepInvocation
|
4
|
+
attr_writer :step_collection, :background
|
5
|
+
attr_reader :name, :matched_cells, :status
|
6
|
+
attr_accessor :exception
|
7
|
+
|
8
|
+
def initialize(step, name, multiline_arg, matched_cells)
|
9
|
+
@step, @name, @multiline_arg, @matched_cells = step, name, multiline_arg, matched_cells
|
10
|
+
status!(:skipped)
|
11
|
+
end
|
12
|
+
|
13
|
+
def background?
|
14
|
+
@background
|
15
|
+
end
|
16
|
+
|
17
|
+
def skip_invoke!
|
18
|
+
@skip_invoke = true
|
19
|
+
end
|
20
|
+
|
21
|
+
def accept(visitor)
|
22
|
+
invoke(visitor.step_mother, visitor.options)
|
23
|
+
@step.visit_step_details(visitor, @step_match, @multiline_arg, @status, @exception, @background)
|
24
|
+
end
|
25
|
+
|
26
|
+
def invoke(step_mother, options)
|
27
|
+
find_step_match!(step_mother)
|
28
|
+
unless @skip_invoke || options[:dry_run] || exception || @step_collection.exception
|
29
|
+
@skip_invoke = true
|
30
|
+
begin
|
31
|
+
step_mother.current_world.__cucumber_current_step = self
|
32
|
+
@step_match.invoke(step_mother.current_world, @multiline_arg)
|
33
|
+
status!(:passed)
|
34
|
+
rescue Pending => e
|
35
|
+
failed(e, false)
|
36
|
+
status!(:pending)
|
37
|
+
rescue Undefined => e
|
38
|
+
failed(e, false)
|
39
|
+
status!(:undefined)
|
40
|
+
rescue Exception => e
|
41
|
+
failed(e, false)
|
42
|
+
status!(:failed)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def find_step_match!(step_mother)
|
48
|
+
return if @step_match
|
49
|
+
begin
|
50
|
+
@step_match = step_mother.step_match(@name)
|
51
|
+
rescue Undefined => e
|
52
|
+
failed(e, true)
|
53
|
+
status!(:undefined)
|
54
|
+
@step_match = NoStepMatch.new(@step)
|
55
|
+
rescue Ambiguous => e
|
56
|
+
failed(e, false)
|
57
|
+
status!(:failed)
|
58
|
+
@step_match = NoStepMatch.new(@step)
|
59
|
+
end
|
60
|
+
step_mother.step_visited(self)
|
61
|
+
end
|
62
|
+
|
63
|
+
def failed(exception, clear_backtrace)
|
64
|
+
@exception = exception
|
65
|
+
@exception.set_backtrace([]) if clear_backtrace
|
66
|
+
@exception.backtrace << @step.backtrace_line unless @step.backtrace_line.nil?
|
67
|
+
end
|
68
|
+
|
69
|
+
def status!(status)
|
70
|
+
@status = status
|
71
|
+
@multiline_arg.status = status if @multiline_arg
|
72
|
+
@matched_cells.each do |cell|
|
73
|
+
cell.status = status
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def previous
|
78
|
+
@step_collection.previous_step(self)
|
79
|
+
end
|
80
|
+
|
81
|
+
def actual_keyword
|
82
|
+
if [Cucumber.keyword_hash['and'], Cucumber.keyword_hash['but']].index(@keyword) && previous
|
83
|
+
previous.actual_keyword
|
84
|
+
else
|
85
|
+
@step.keyword
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def matches_lines?(lines)
|
90
|
+
@step.matches_lines?(lines)
|
91
|
+
end
|
92
|
+
|
93
|
+
def text_length
|
94
|
+
@step.text_length
|
95
|
+
end
|
96
|
+
|
97
|
+
def file_colon_line
|
98
|
+
@step.file_colon_line
|
99
|
+
end
|
100
|
+
|
101
|
+
def backtrace_line
|
102
|
+
@step.backtrace_line
|
103
|
+
end
|
104
|
+
|
105
|
+
def to_sexp
|
106
|
+
[:step_invocation, @step.line, @step.keyword, @name, (@multiline_arg.nil? ? nil : @multiline_arg.to_sexp)].compact
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/lib/cucumber/ast/table.rb
CHANGED
@@ -7,7 +7,7 @@ module Cucumber
|
|
7
7
|
#
|
8
8
|
# This gets parsed into a Table holding the values <tt>[['a', 'b'], ['c', 'd']]</tt>
|
9
9
|
#
|
10
|
-
class Table
|
10
|
+
class Table
|
11
11
|
NULL_CONVERSIONS = Hash.new(lambda{ |cell_value| cell_value }).freeze
|
12
12
|
|
13
13
|
attr_accessor :file
|
@@ -84,17 +84,23 @@ module Cucumber
|
|
84
84
|
cells_rows.each(&proc)
|
85
85
|
end
|
86
86
|
|
87
|
-
def
|
88
|
-
cells_rows.detect
|
87
|
+
def matches_lines?(lines)
|
88
|
+
cells_rows.detect{|row| row.matches_lines?(lines)}
|
89
89
|
end
|
90
90
|
|
91
|
-
def accept(visitor
|
91
|
+
def accept(visitor)
|
92
92
|
cells_rows.each do |row|
|
93
|
-
visitor.visit_table_row(row
|
93
|
+
visitor.visit_table_row(row)
|
94
94
|
end
|
95
95
|
nil
|
96
96
|
end
|
97
97
|
|
98
|
+
def status=(status)
|
99
|
+
cells_rows.each do |row|
|
100
|
+
row.status = status
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
98
104
|
# For testing only
|
99
105
|
def to_sexp #:nodoc:
|
100
106
|
[:table, *cells_rows.map{|row| row.to_sexp}]
|
@@ -152,17 +158,24 @@ module Cucumber
|
|
152
158
|
row.map do |cell|
|
153
159
|
cell_with_replaced_args = cell
|
154
160
|
arguments.each do |name, value|
|
155
|
-
cell_with_replaced_args
|
161
|
+
if cell_with_replaced_args && cell_with_replaced_args.include?(name)
|
162
|
+
cell_with_replaced_args = value ? cell_with_replaced_args.gsub(name, value) : nil
|
163
|
+
end
|
156
164
|
end
|
157
165
|
cell_with_replaced_args
|
158
166
|
end
|
159
167
|
end
|
160
|
-
|
161
168
|
Table.new(raw_with_replaced_args)
|
162
169
|
end
|
163
170
|
|
164
|
-
def
|
165
|
-
|
171
|
+
def cells_rows
|
172
|
+
@rows ||= cell_matrix.map do |cell_row|
|
173
|
+
@cells_class.new(self, cell_row)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def header_cell(col)
|
178
|
+
cells_rows[0][col]
|
166
179
|
end
|
167
180
|
|
168
181
|
protected
|
@@ -183,12 +196,6 @@ module Cucumber
|
|
183
196
|
columns[col].__send__(:width)
|
184
197
|
end
|
185
198
|
|
186
|
-
def cells_rows
|
187
|
-
@rows ||= cell_matrix.map do |cell_row|
|
188
|
-
@cells_class.new(self, cell_row)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
199
|
def columns
|
193
200
|
@columns ||= cell_matrix.transpose.map do |cell_row|
|
194
201
|
@cells_class.new(self, cell_row)
|
@@ -211,14 +218,19 @@ module Cucumber
|
|
211
218
|
# Represents a row of cells or columns of cells
|
212
219
|
class Cells
|
213
220
|
include Enumerable
|
221
|
+
attr_reader :exception
|
214
222
|
|
215
223
|
def initialize(table, cells)
|
216
224
|
@table, @cells = table, cells
|
217
225
|
end
|
218
226
|
|
219
|
-
def
|
227
|
+
def matches_lines?(lines)
|
228
|
+
lines.index(line)
|
229
|
+
end
|
230
|
+
|
231
|
+
def accept(visitor)
|
220
232
|
each do |cell|
|
221
|
-
visitor.visit_table_cell(cell
|
233
|
+
visitor.visit_table_cell(cell)
|
222
234
|
end
|
223
235
|
nil
|
224
236
|
end
|
@@ -244,8 +256,10 @@ module Cucumber
|
|
244
256
|
@cells[0].line
|
245
257
|
end
|
246
258
|
|
247
|
-
def
|
248
|
-
|
259
|
+
def status=(status)
|
260
|
+
each do |cell|
|
261
|
+
cell.status = status
|
262
|
+
end
|
249
263
|
end
|
250
264
|
|
251
265
|
private
|
@@ -265,13 +279,19 @@ module Cucumber
|
|
265
279
|
|
266
280
|
class Cell
|
267
281
|
attr_reader :value, :line
|
282
|
+
attr_writer :status
|
268
283
|
|
269
284
|
def initialize(value, table, row, col, line)
|
270
285
|
@value, @table, @row, @col, @line = value, table, row, col, line
|
286
|
+
@status = :passed
|
287
|
+
end
|
288
|
+
|
289
|
+
def accept(visitor)
|
290
|
+
visitor.visit_table_cell_value(@value, col_width, @status)
|
271
291
|
end
|
272
292
|
|
273
|
-
def
|
274
|
-
|
293
|
+
def header_cell
|
294
|
+
@table.header_cell(@col)
|
275
295
|
end
|
276
296
|
|
277
297
|
# For testing only
|