kosmas58-cucumber 0.2.2.1 → 0.2.3.3
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/History.txt +57 -5
- data/Manifest.txt +21 -4
- data/bin/cucumber +1 -1
- data/config/hoe.rb +2 -2
- data/examples/i18n/Rakefile +6 -8
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ar/lib/calculator.rb +1 -0
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -1
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -1
- data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +1 -1
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -1
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ko/features/addition.feature +1 -1
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/no/features/support/env.rb +1 -1
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ru/features/support/env.rb +1 -1
- data/examples/i18n/ru/features/support/world.rb +4 -3
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/sk/Rakefile +6 -0
- data/examples/i18n/sk/features/addition.feature +16 -0
- data/examples/i18n/sk/features/division.feature +9 -0
- data/examples/i18n/sk/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/sk/lib/calculator.rb +14 -0
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/self_test/features/background/background_with_name.feature +7 -0
- data/examples/self_test/features/step_definitions/sample_steps.rb +8 -2
- data/examples/self_test/features/undefined_multiline_args.feature +12 -0
- data/examples/sinatra/features/support/env.rb +2 -6
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +1 -4
- data/examples/tickets/Rakefile +1 -1
- data/examples/tickets/features/246.feature +4 -0
- data/examples/tickets/features/270/back.feature +14 -0
- data/examples/tickets/features/270/back.steps.rb +14 -0
- data/examples/tickets/features/step_definitons/246_steps.rb +3 -0
- data/features/background.feature +21 -4
- data/features/cucumber_cli.feature +18 -5
- data/features/cucumber_cli_outlines.feature +5 -2
- data/features/snippet.feature +23 -0
- data/features/step_definitions/cucumber_steps.rb +6 -2
- data/features/usage.feature +5 -0
- data/gem_tasks/rspec.rake +3 -2
- data/lib/cucumber/ast/background.rb +3 -3
- data/lib/cucumber/ast/examples.rb +0 -12
- data/lib/cucumber/ast/feature.rb +2 -12
- data/lib/cucumber/ast/feature_element.rb +0 -8
- data/lib/cucumber/ast/features.rb +1 -1
- data/lib/cucumber/ast/outline_table.rb +14 -22
- data/lib/cucumber/ast/py_string.rb +6 -11
- data/lib/cucumber/ast/scenario.rb +1 -8
- data/lib/cucumber/ast/scenario_outline.rb +1 -11
- data/lib/cucumber/ast/step.rb +3 -9
- data/lib/cucumber/ast/step_collection.rb +0 -4
- data/lib/cucumber/ast/step_invocation.rb +5 -6
- data/lib/cucumber/ast/table.rb +26 -22
- data/lib/cucumber/ast/tags.rb +0 -8
- data/lib/cucumber/ast/visitor.rb +12 -25
- data/lib/cucumber/cli/configuration.rb +2 -2
- data/lib/cucumber/cli/main.rb +5 -2
- data/lib/cucumber/core_ext/instance_exec.rb +17 -4
- data/lib/cucumber/formatter/ansicolor.rb +10 -2
- data/lib/cucumber/formatter/console.rb +2 -1
- data/lib/cucumber/formatter/html.rb +21 -7
- data/lib/cucumber/formatter/pretty.rb +27 -20
- data/lib/cucumber/formatter/usage.rb +16 -0
- data/lib/cucumber/languages.yml +68 -7
- data/lib/cucumber/parser/feature.rb +238 -135
- data/lib/cucumber/parser/feature.tt +117 -22
- data/lib/cucumber/parser/i18n.tt +4 -0
- data/lib/cucumber/parser/table.rb +37 -25
- data/lib/cucumber/parser/table.tt +15 -3
- data/lib/cucumber/parser/treetop_ext.rb +48 -9
- data/lib/cucumber/parser.rb +2 -7
- data/lib/cucumber/step_definition.rb +13 -14
- data/lib/cucumber/step_mother.rb +93 -11
- data/lib/cucumber/version.rb +2 -2
- data/rails_generators/cucumber/templates/env.rb +1 -1
- data/rails_generators/cucumber/templates/paths.rb +15 -5
- data/rails_generators/cucumber/templates/webrat_steps.rb +8 -0
- data/spec/cucumber/ast/background_spec.rb +1 -0
- data/spec/cucumber/ast/feature_factory.rb +1 -1
- data/spec/cucumber/ast/feature_spec.rb +2 -2
- data/spec/cucumber/ast/scenario_spec.rb +0 -27
- data/spec/cucumber/ast/table_spec.rb +23 -2
- data/spec/cucumber/core_ext/proc_spec.rb +25 -8
- data/spec/cucumber/parser/feature_parser_spec.rb +43 -41
- data/spec/cucumber/step_definition_spec.rb +8 -0
- data/spec/cucumber/step_mother_spec.rb +48 -0
- data/spec/spec_helper.rb +2 -11
- metadata +17 -6
- data/examples/tickets/cucumber.yml +0 -3
- data/lib/cucumber/parser/basic.rb +0 -0
- data/spec/cucumber/ast/tags_spec.rb +0 -19
data/features/background.feature
CHANGED
@@ -16,7 +16,7 @@ Feature: backgrounds
|
|
16
16
|
Then I should have '10' cukes
|
17
17
|
|
18
18
|
1 scenario
|
19
|
-
|
19
|
+
2 passed steps
|
20
20
|
|
21
21
|
"""
|
22
22
|
|
@@ -64,7 +64,7 @@ Feature: backgrounds
|
|
64
64
|
| 10 |
|
65
65
|
|
66
66
|
2 scenarios
|
67
|
-
|
67
|
+
4 passed steps
|
68
68
|
|
69
69
|
"""
|
70
70
|
|
@@ -123,7 +123,7 @@ Feature: backgrounds
|
|
123
123
|
|
124
124
|
2 scenarios
|
125
125
|
1 failed step
|
126
|
-
|
126
|
+
3 skipped steps
|
127
127
|
|
128
128
|
"""
|
129
129
|
|
@@ -217,5 +217,22 @@ Feature: backgrounds
|
|
217
217
|
|
218
218
|
"""
|
219
219
|
|
220
|
-
|
220
|
+
Scenario: background with name
|
221
|
+
When I run cucumber -q features/background/background_with_name.feature --require features
|
222
|
+
Then it should pass with
|
223
|
+
"""
|
224
|
+
Feature: background with name
|
225
|
+
|
226
|
+
Background: I'm a background and I'm ok
|
227
|
+
Given '10' cukes
|
228
|
+
|
229
|
+
Scenario: example
|
230
|
+
Then I should have '10' cukes
|
231
|
+
|
232
|
+
1 scenario
|
233
|
+
2 passed steps
|
234
|
+
|
235
|
+
"""
|
236
|
+
|
237
|
+
@josephwilk
|
221
238
|
Scenario: run a scenario showing explicit background steps --explicit-background
|
@@ -229,15 +229,28 @@ Feature: Cucumber command line
|
|
229
229
|
hello
|
230
230
|
\"\"\"
|
231
231
|
|
232
|
-
|
232
|
+
Feature: undefined multiline args
|
233
|
+
|
234
|
+
Scenario: pystring
|
235
|
+
Given a pystring
|
236
|
+
\"\"\"
|
237
|
+
example
|
238
|
+
\"\"\"
|
239
|
+
|
240
|
+
Scenario: table
|
241
|
+
Given a table
|
242
|
+
| table |
|
243
|
+
| example |
|
244
|
+
|
245
|
+
14 scenarios
|
233
246
|
12 skipped steps
|
234
|
-
|
247
|
+
9 undefined steps
|
235
248
|
|
236
249
|
"""
|
237
250
|
|
238
251
|
Scenario: Multiple formatters and outputs
|
239
252
|
When I run cucumber --format progress --out tmp/progress.txt --format pretty --out tmp/pretty.txt --dry-run features/lots_of_undefined.feature
|
240
|
-
And examples/self_test/tmp/progress.txt should contain
|
253
|
+
And "examples/self_test/tmp/progress.txt" should contain
|
241
254
|
"""
|
242
255
|
UUUUU
|
243
256
|
|
@@ -245,7 +258,7 @@ Feature: Cucumber command line
|
|
245
258
|
5 undefined steps
|
246
259
|
|
247
260
|
"""
|
248
|
-
And examples/self_test/tmp/pretty.txt should match
|
261
|
+
And "examples/self_test/tmp/pretty.txt" should match
|
249
262
|
"""
|
250
263
|
Feature: Lots of undefined
|
251
264
|
|
@@ -362,7 +375,7 @@ Feature: Cucumber command line
|
|
362
375
|
|
363
376
|
Scenario: Reformat files with --autoformat
|
364
377
|
When I run cucumber --autoformat tmp/formatted features
|
365
|
-
Then examples/self_test/tmp/formatted/features/sample.feature should contain
|
378
|
+
Then "examples/self_test/tmp/formatted/features/sample.feature" should contain
|
366
379
|
"""
|
367
380
|
@one
|
368
381
|
Feature: Sample
|
@@ -41,7 +41,7 @@ Feature: Cucumber command line
|
|
41
41
|
Feature: Outline Sample
|
42
42
|
|
43
43
|
Scenario Outline: Test state # features/outline_sample.feature:5
|
44
|
-
Given <state> without a table # features/step_definitions/sample_steps.rb:
|
44
|
+
Given <state> without a table # features/step_definitions/sample_steps.rb:15
|
45
45
|
Given <other_state> without a table # features/step_definitions/sample_steps.rb:12
|
46
46
|
|
47
47
|
Examples: Rainbow colours
|
@@ -58,11 +58,14 @@ Feature: Cucumber command line
|
|
58
58
|
|
59
59
|
"""
|
60
60
|
|
61
|
+
# There are 10 characters in the progress, but only 8 reported steps. Needs investigation.
|
62
|
+
# Looks like we're outputting too many characters.
|
63
|
+
@buggy
|
61
64
|
Scenario: Run all with progress formatter
|
62
65
|
When I run cucumber -q --format progress features/outline_sample.feature
|
63
66
|
Then it should fail with
|
64
67
|
"""
|
65
|
-
|
68
|
+
--U-..F-..
|
66
69
|
|
67
70
|
(::) failed steps (::)
|
68
71
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Snippets
|
2
|
+
In order to help speed up writing step definitions
|
3
|
+
As a feature editor
|
4
|
+
I want snippet suggestions for undefined step definitions
|
5
|
+
|
6
|
+
Scenario: Snippet for undefined step with a pystring
|
7
|
+
When I run cucumber features/undefined_multiline_args.feature:3 -n
|
8
|
+
Then the output should contain
|
9
|
+
"""
|
10
|
+
Given /^a pystring$/ do |string|
|
11
|
+
# string is a Cucumber::Ast::PyString
|
12
|
+
pending
|
13
|
+
end
|
14
|
+
"""
|
15
|
+
Scenario: Snippet for undefined step with a step table
|
16
|
+
When I run cucumber features/undefined_multiline_args.feature:9 -n
|
17
|
+
Then the output should contain
|
18
|
+
"""
|
19
|
+
Given /^a table$/ do |table|
|
20
|
+
# table is a Cucumber::Ast::Table
|
21
|
+
pending
|
22
|
+
end
|
23
|
+
"""
|
@@ -21,10 +21,14 @@ Then /^it should (fail|pass) with$/ do |success, output|
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
Then /^
|
24
|
+
Then /^the output should contain$/ do |text|
|
25
|
+
@out.should include(text)
|
26
|
+
end
|
27
|
+
|
28
|
+
Then /^"(.*)" should contain$/ do |file, text|
|
25
29
|
IO.read(file).should == text
|
26
30
|
end
|
27
31
|
|
28
|
-
Then /^(.*) should match$/ do |file, text|
|
32
|
+
Then /^"(.*)" should match$/ do |file, text|
|
29
33
|
IO.read(file).should =~ Regexp.new(text)
|
30
34
|
end
|
data/features/usage.feature
CHANGED
@@ -19,6 +19,7 @@ Feature: Cucumber command line
|
|
19
19
|
/^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
|
20
20
|
Given call step "a step definition that calls an undefined step" # features/call_undefined_step_from_step_def.feature:7
|
21
21
|
/^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
|
22
|
+
Given '10' cukes # features/background/background_with_name.feature:4
|
22
23
|
And '10' cukes # features/background/failing_background.feature:5
|
23
24
|
Given '10' cukes # features/background/passing_background.feature:4
|
24
25
|
Given '10' cukes # features/background/scenario_outline_passing_background.feature:4
|
@@ -72,6 +73,7 @@ Feature: Cucumber command line
|
|
72
73
|
Given '2' cukes # features/tons_of_cukes.feature:51
|
73
74
|
Given '2' cukes # features/tons_of_cukes.feature:52
|
74
75
|
/^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
|
76
|
+
Then I should have '10' cukes # features/background/background_with_name.feature:7
|
75
77
|
Then I should have '10' cukes # features/background/failing_background.feature:8
|
76
78
|
Then I should have '10' cukes # features/background/failing_background.feature:11
|
77
79
|
Then I should have '10' cukes # features/background/passing_background.feature:7
|
@@ -103,6 +105,9 @@ Feature: Cucumber command line
|
|
103
105
|
Given failing expectation # features/failing_expectation.feature:4
|
104
106
|
/^failing$/ # features/step_definitions/sample_steps.rb:8
|
105
107
|
Given failing # features/sample.feature:16
|
108
|
+
(::) UNUSED (::)
|
109
|
+
/^unused$/ # features/step_definitions/sample_steps.rb:66
|
110
|
+
/^another unused$/ # features/step_definitions/sample_steps.rb:69
|
106
111
|
|
107
112
|
"""
|
108
113
|
|
data/gem_tasks/rspec.rake
CHANGED
@@ -29,9 +29,10 @@ if require_spec
|
|
29
29
|
|
30
30
|
desc "Run the Cucumber specs"
|
31
31
|
Spec::Rake::SpecTask.new do |t|
|
32
|
-
t.spec_opts = ['--options', "
|
33
|
-
t.spec_files = FileList['
|
32
|
+
t.spec_opts = ['--options', "specs/spec.opts"]
|
33
|
+
t.spec_files = FileList['specs/**/*_spec.rb']
|
34
34
|
t.rcov = ENV['RCOV']
|
35
35
|
t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/}
|
36
|
+
t.verbose = true
|
36
37
|
end
|
37
38
|
end
|
@@ -6,8 +6,8 @@ module Cucumber
|
|
6
6
|
include FeatureElement
|
7
7
|
attr_writer :feature
|
8
8
|
|
9
|
-
def initialize(comment, line, keyword, steps)
|
10
|
-
@comment, @line, @keyword, @steps = comment, line, keyword, StepCollection.new(steps)
|
9
|
+
def initialize(comment, line, keyword, name, steps)
|
10
|
+
@comment, @line, @keyword, @name, @steps = comment, line, keyword, name, StepCollection.new(steps)
|
11
11
|
attach_steps(steps)
|
12
12
|
@step_invocations = @steps.step_invocations(true)
|
13
13
|
end
|
@@ -23,7 +23,7 @@ module Cucumber
|
|
23
23
|
|
24
24
|
def accept(visitor)
|
25
25
|
visitor.visit_comment(@comment)
|
26
|
-
visitor.visit_background_name(@keyword,
|
26
|
+
visitor.visit_background_name(@keyword, @name, file_colon_line(@line), source_indent(text_length))
|
27
27
|
visitor.step_mother.before_and_after(self)
|
28
28
|
visitor.visit_steps(@step_invocations)
|
29
29
|
@failed = @step_invocations.detect{|step_invocation| step_invocation.exception}
|
@@ -10,26 +10,14 @@ module Cucumber
|
|
10
10
|
visitor.visit_outline_table(@outline_table)
|
11
11
|
end
|
12
12
|
|
13
|
-
def descend?(visitor)
|
14
|
-
@outline_table.descend?(visitor)
|
15
|
-
end
|
16
|
-
|
17
13
|
def skip_invoke!
|
18
14
|
@outline_table.skip_invoke!
|
19
15
|
end
|
20
16
|
|
21
|
-
def matches_scenario_names?(scenario_names)
|
22
|
-
scenario_names.detect{|name| name == @name}
|
23
|
-
end
|
24
|
-
|
25
17
|
def each_example_row(&proc)
|
26
18
|
@outline_table.cells_rows[1..-1].each(&proc)
|
27
19
|
end
|
28
20
|
|
29
|
-
def matches_lines?(lines)
|
30
|
-
lines.index(@line) || @outline_table.matches_lines?(lines)
|
31
|
-
end
|
32
|
-
|
33
21
|
def to_sexp
|
34
22
|
[:examples, @keyword, @name, @outline_table.to_sexp]
|
35
23
|
end
|
data/lib/cucumber/ast/feature.rb
CHANGED
@@ -3,11 +3,10 @@ module Cucumber
|
|
3
3
|
# Represents the root node of a parsed feature.
|
4
4
|
class Feature
|
5
5
|
attr_accessor :file
|
6
|
-
attr_writer :features
|
6
|
+
attr_writer :features
|
7
7
|
|
8
8
|
def initialize(background, comment, tags, name, feature_elements)
|
9
9
|
@background, @comment, @tags, @name, @feature_elements = background, comment, tags, name, feature_elements
|
10
|
-
@lines = []
|
11
10
|
|
12
11
|
@feature_elements.each do |feature_element|
|
13
12
|
feature_element.feature = self
|
@@ -15,24 +14,15 @@ module Cucumber
|
|
15
14
|
end
|
16
15
|
|
17
16
|
def accept(visitor)
|
18
|
-
visitor.current_feature_lines = @lines
|
19
17
|
visitor.visit_comment(@comment)
|
20
18
|
visitor.visit_tags(@tags)
|
21
19
|
visitor.visit_feature_name(@name)
|
22
20
|
visitor.visit_background(@background) if @background
|
23
21
|
@feature_elements.each do |feature_element|
|
24
|
-
visitor.visit_feature_element(feature_element)
|
22
|
+
visitor.visit_feature_element(feature_element)
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
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)
|
34
|
-
end
|
35
|
-
|
36
26
|
def next_feature_element(feature_element, &proc)
|
37
27
|
index = @feature_elements.index(feature_element)
|
38
28
|
next_one = @feature_elements[index+1]
|
@@ -12,14 +12,6 @@ module Cucumber
|
|
12
12
|
@keyword.jlength + @name.jlength
|
13
13
|
end
|
14
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
15
|
def matches_scenario_names?(scenario_names)
|
24
16
|
scenario_names.detect{|name| name == @name}
|
25
17
|
end
|
@@ -5,45 +5,37 @@ 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
|
+
create_step_invocations_for_example_rows!(scenario_outline)
|
12
9
|
end
|
13
10
|
|
14
11
|
def accept(visitor)
|
15
12
|
cells_rows.each_with_index do |row, n|
|
16
|
-
|
17
|
-
visitor.visit_table_row(row)
|
18
|
-
end
|
13
|
+
visitor.visit_table_row(row)
|
19
14
|
end
|
20
15
|
nil
|
21
16
|
end
|
22
17
|
|
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
18
|
def skip_invoke!
|
33
|
-
|
19
|
+
example_rows.each do |cells|
|
34
20
|
cells.skip_invoke!
|
35
21
|
end
|
36
22
|
end
|
37
23
|
|
24
|
+
def create_step_invocations_for_example_rows!(scenario_outline)
|
25
|
+
example_rows.each do |cells|
|
26
|
+
cells.create_step_invocations!(scenario_outline)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def example_rows
|
31
|
+
cells_rows[1..-1]
|
32
|
+
end
|
33
|
+
|
38
34
|
class ExampleCells < Cells
|
39
35
|
def create_step_invocations!(scenario_outline)
|
40
36
|
@step_invocations = scenario_outline.step_invocations(self)
|
41
37
|
end
|
42
38
|
|
43
|
-
def descend?(visitor)
|
44
|
-
@table.matches?(visitor, self)
|
45
|
-
end
|
46
|
-
|
47
39
|
def skip_invoke!
|
48
40
|
@step_invocations.each do |step_invocation|
|
49
41
|
step_invocation.skip_invoke!
|
@@ -53,7 +45,7 @@ module Cucumber
|
|
53
45
|
def accept(visitor)
|
54
46
|
if header?
|
55
47
|
@cells.each do |cell|
|
56
|
-
cell.status = :
|
48
|
+
cell.status = :skipped_param
|
57
49
|
visitor.visit_table_cell(cell)
|
58
50
|
end
|
59
51
|
else
|
@@ -17,26 +17,22 @@ module Cucumber
|
|
17
17
|
# Note how the indentation from the source is stripped away.
|
18
18
|
#
|
19
19
|
class PyString
|
20
|
+
|
21
|
+
def self.default_arg_name
|
22
|
+
"string"
|
23
|
+
end
|
24
|
+
|
20
25
|
def initialize(start_line, end_line, string, quotes_indent)
|
21
26
|
@start_line, @end_line = start_line, end_line
|
22
27
|
@string, @quotes_indent = string.gsub(/\\"/, '"'), quotes_indent
|
23
|
-
@status = :passed
|
24
|
-
end
|
25
|
-
|
26
|
-
def status=(status)
|
27
|
-
@status = status
|
28
28
|
end
|
29
29
|
|
30
30
|
def to_s
|
31
31
|
@string.indent(-@quotes_indent)
|
32
32
|
end
|
33
33
|
|
34
|
-
def matches_lines?(lines)
|
35
|
-
lines.detect{|l| l >= @start_line && l <= @end_line}
|
36
|
-
end
|
37
|
-
|
38
34
|
def accept(visitor)
|
39
|
-
visitor.visit_py_string(to_s
|
35
|
+
visitor.visit_py_string(to_s)
|
40
36
|
end
|
41
37
|
|
42
38
|
def arguments_replaced(arguments) #:nodoc:
|
@@ -52,7 +48,6 @@ module Cucumber
|
|
52
48
|
def to_sexp #:nodoc:
|
53
49
|
[:py_string, to_s]
|
54
50
|
end
|
55
|
-
|
56
51
|
end
|
57
52
|
end
|
58
53
|
end
|
@@ -8,7 +8,7 @@ module Cucumber
|
|
8
8
|
def initialize(background, comment, tags, line, keyword, name, steps)
|
9
9
|
@background, @comment, @tags, @line, @keyword, @name = background, comment, tags, line, keyword, name
|
10
10
|
attach_steps(steps)
|
11
|
-
|
11
|
+
|
12
12
|
step_invocations = steps.map{|step| step.step_invocation}
|
13
13
|
if @background
|
14
14
|
@steps = @background.step_collection(step_invocations)
|
@@ -22,13 +22,6 @@ module Cucumber
|
|
22
22
|
@background.feature = feature if @background
|
23
23
|
end
|
24
24
|
|
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)
|
30
|
-
end
|
31
|
-
|
32
25
|
def accept(visitor)
|
33
26
|
visitor.visit_comment(@comment)
|
34
27
|
visitor.visit_tags(@tags)
|
@@ -30,16 +30,6 @@ module Cucumber
|
|
30
30
|
@background.feature = feature if @background
|
31
31
|
end
|
32
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)
|
41
|
-
end
|
42
|
-
|
43
33
|
def accept(visitor)
|
44
34
|
visitor.visit_comment(@comment)
|
45
35
|
visitor.visit_tags(@tags)
|
@@ -48,7 +38,7 @@ module Cucumber
|
|
48
38
|
|
49
39
|
skip_invoke! if @background && @background.failed?
|
50
40
|
@examples_array.each do |examples|
|
51
|
-
visitor.visit_examples(examples)
|
41
|
+
visitor.visit_examples(examples)
|
52
42
|
end
|
53
43
|
end
|
54
44
|
|
data/lib/cucumber/ast/step.rb
CHANGED
@@ -33,13 +33,11 @@ module Cucumber
|
|
33
33
|
def accept(visitor)
|
34
34
|
# The only time a Step is visited is when it is in a ScenarioOutline.
|
35
35
|
# Otherwise it's always StepInvocation that gest visited instead.
|
36
|
-
|
36
|
+
visit_step_result(visitor, first_match(visitor), @multiline_arg, :skipped, nil, nil)
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
visitor.
|
41
|
-
visitor.visit_multiline_arg(@multiline_arg) if @multiline_arg
|
42
|
-
visitor.visit_exception(exception, status) if exception
|
39
|
+
def visit_step_result(visitor, step_match, multiline_arg, status, exception, background)
|
40
|
+
visitor.visit_step_result(@keyword, step_match, @multiline_arg, status, exception, source_indent, background)
|
43
41
|
end
|
44
42
|
|
45
43
|
def first_match(visitor)
|
@@ -58,10 +56,6 @@ module Cucumber
|
|
58
56
|
[:step, @line, @keyword, @name, (@multiline_arg.nil? ? nil : @multiline_arg.to_sexp)].compact
|
59
57
|
end
|
60
58
|
|
61
|
-
def matches_lines?(lines)
|
62
|
-
lines.index(@line) || (@multiline_arg && @multiline_arg.matches_lines?(lines))
|
63
|
-
end
|
64
|
-
|
65
59
|
def source_indent
|
66
60
|
@feature_element.source_indent(text_length)
|
67
61
|
end
|
@@ -20,7 +20,7 @@ module Cucumber
|
|
20
20
|
|
21
21
|
def accept(visitor)
|
22
22
|
invoke(visitor.step_mother, visitor.options)
|
23
|
-
@step.
|
23
|
+
@step.visit_step_result(visitor, @step_match, @multiline_arg, @status, @exception, @background)
|
24
24
|
end
|
25
25
|
|
26
26
|
def invoke(step_mother, options)
|
@@ -68,7 +68,6 @@ module Cucumber
|
|
68
68
|
|
69
69
|
def status!(status)
|
70
70
|
@status = status
|
71
|
-
@multiline_arg.status = status if @multiline_arg
|
72
71
|
@matched_cells.each do |cell|
|
73
72
|
cell.status = status
|
74
73
|
end
|
@@ -86,10 +85,6 @@ module Cucumber
|
|
86
85
|
end
|
87
86
|
end
|
88
87
|
|
89
|
-
def matches_lines?(lines)
|
90
|
-
@step.matches_lines?(lines)
|
91
|
-
end
|
92
|
-
|
93
88
|
def text_length
|
94
89
|
@step.text_length
|
95
90
|
end
|
@@ -98,6 +93,10 @@ module Cucumber
|
|
98
93
|
@step.keyword
|
99
94
|
end
|
100
95
|
|
96
|
+
def multiline_arg
|
97
|
+
@step.multiline_arg
|
98
|
+
end
|
99
|
+
|
101
100
|
def file_colon_line
|
102
101
|
@step.file_colon_line
|
103
102
|
end
|