cucumber 0.3.6 → 0.3.7
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 +14 -1
- data/Manifest.txt +1 -0
- data/examples/i18n/fr/features/addition.feature +4 -4
- data/features/after_block_exceptions.feature +3 -1
- data/features/after_step_block_exceptions.feature +4 -2
- data/features/background.feature +3 -0
- data/features/cucumber_cli.feature +3 -2
- data/features/cucumber_cli_diff_disabled.feature +2 -0
- data/features/cucumber_cli_outlines.feature +4 -1
- data/features/expand.feature +48 -0
- data/features/junit_formatter.feature +4 -1
- data/features/report_called_undefined_steps.feature +1 -0
- data/features/step_definitions/cucumber_steps.rb +2 -2
- data/features/support/env.rb +5 -0
- data/features/usage.feature +23 -22
- data/features/work_in_progress.feature +2 -0
- data/gem_tasks/rspec.rake +9 -2
- data/lib/cucumber.rb +4 -0
- data/lib/cucumber/ast/outline_table.rb +31 -2
- data/lib/cucumber/ast/scenario_outline.rb +4 -0
- data/lib/cucumber/ast/step.rb +3 -3
- data/lib/cucumber/ast/step_invocation.rb +12 -4
- data/lib/cucumber/cli/configuration.rb +3 -0
- data/lib/cucumber/formatter/pretty.rb +6 -2
- data/lib/cucumber/formatter/usage.rb +3 -3
- data/lib/cucumber/languages.yml +2 -2
- data/lib/cucumber/rake/task.rb +1 -1
- data/lib/cucumber/step_match.rb +3 -2
- data/lib/cucumber/version.rb +1 -1
- data/rails_generators/cucumber/templates/cucumber.rake +1 -1
- metadata +3 -2
data/History.txt
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
== 0.3.
|
1
|
+
== 0.3.7 2009-05-22
|
2
|
+
|
3
|
+
This is the "Help JetBrains RubyMine" release!
|
4
|
+
|
5
|
+
=== New Features
|
6
|
+
* Added new Given alias for Catalan: Donat|Donada (Lleïr Borràs Metje)
|
7
|
+
* New --expand option. This will print Scenario Outlines once for each Example row - with values expanded. (#327 Aslak Hellesøy)
|
8
|
+
* You can override the formatter in Rails-generated rake tasks with the CUCUMBER_FORMAT environment variable (#335 Aslak Hellesøy)
|
9
|
+
|
10
|
+
=== Bugfixes
|
11
|
+
* 'specs' folder needs to be renamed back to 'spec' (#339 Aslak Hellesøy)
|
12
|
+
* CUCUMBER_OPTS doesn't work for cucumber rake tasks (#336 Aslak Hellesøy)
|
13
|
+
|
14
|
+
== 0.3.6 2009-05-20
|
2
15
|
|
3
16
|
Kanban! With this release you can tag features or scenarios that are work in progress
|
4
17
|
with a tag and use the new --wip switch.
|
data/Manifest.txt
CHANGED
@@ -245,6 +245,7 @@ features/cucumber_cli_diff_disabled.feature
|
|
245
245
|
features/cucumber_cli_outlines.feature
|
246
246
|
features/custom_formatter.feature
|
247
247
|
features/exclude_files.feature
|
248
|
+
features/expand.feature
|
248
249
|
features/junit_formatter.feature
|
249
250
|
features/multiline_names.feature
|
250
251
|
features/rake_task.feature
|
@@ -24,6 +24,7 @@ Feature: After Block Exceptions
|
|
24
24
|
end
|
25
25
|
"""
|
26
26
|
|
27
|
+
@mri186
|
27
28
|
Scenario: Handle Exception in standard scenario step and carry on
|
28
29
|
Given a file named "features/naughty_step_in_scenario.feature" with:
|
29
30
|
"""
|
@@ -52,7 +53,8 @@ Feature: After Block Exceptions
|
|
52
53
|
2 steps (2 passed)
|
53
54
|
|
54
55
|
"""
|
55
|
-
|
56
|
+
|
57
|
+
@mri186
|
56
58
|
Scenario: Handle Exception in scenario outline table row and carry on
|
57
59
|
Given a file named "features/naughty_step_in_scenario_outline.feature" with:
|
58
60
|
"""
|
@@ -24,6 +24,7 @@ Feature: AfterStep Block Exceptions
|
|
24
24
|
end
|
25
25
|
"""
|
26
26
|
|
27
|
+
@mri186
|
27
28
|
Scenario: Handle Exception in standard scenario step and carry on
|
28
29
|
Given a file named "features/naughty_step_in_scenario.feature" with:
|
29
30
|
"""
|
@@ -53,8 +54,9 @@ Feature: AfterStep Block Exceptions
|
|
53
54
|
2 steps (1 failed, 1 passed)
|
54
55
|
|
55
56
|
"""
|
56
|
-
|
57
|
-
|
57
|
+
|
58
|
+
@mri186
|
59
|
+
Scenario: Handle Exception in scenario outline table row and carry on
|
58
60
|
Given a file named "features/naughty_step_in_scenario_outline.feature" with:
|
59
61
|
"""
|
60
62
|
Feature: Sample
|
data/features/background.feature
CHANGED
@@ -90,6 +90,7 @@ Feature: backgrounds
|
|
90
90
|
|
91
91
|
"""
|
92
92
|
|
93
|
+
@mri186
|
93
94
|
Scenario: run a feature with a background that fails
|
94
95
|
When I run cucumber -q features/background/failing_background.feature --require features
|
95
96
|
Then it should fail with
|
@@ -117,6 +118,7 @@ Feature: backgrounds
|
|
117
118
|
"""
|
118
119
|
And "examples/self_test/tmp/after.txt" should exist
|
119
120
|
|
121
|
+
@mri186
|
120
122
|
Scenario: run a feature with scenario outlines that has a background that fails
|
121
123
|
When I run cucumber -q features/background/scenario_outline_failing_background.feature --require features
|
122
124
|
Then it should fail with
|
@@ -169,6 +171,7 @@ Feature: backgrounds
|
|
169
171
|
|
170
172
|
"""
|
171
173
|
|
174
|
+
@mri186
|
172
175
|
Scenario: background passes with first scenario but fails with second
|
173
176
|
When I run cucumber -q features/background/failing_background_after_success.feature --require features
|
174
177
|
Then it should fail with
|
@@ -2,8 +2,6 @@ Feature: Cucumber command line
|
|
2
2
|
In order to write better software
|
3
3
|
Developers should be able to execute requirements as tests
|
4
4
|
|
5
|
-
|
6
|
-
|
7
5
|
Scenario: Run single scenario with missing step definition
|
8
6
|
When I run cucumber -q features/sample.feature:5
|
9
7
|
Then it should pass with
|
@@ -56,6 +54,7 @@ Feature: Cucumber command line
|
|
56
54
|
|
57
55
|
"""
|
58
56
|
|
57
|
+
@mri186
|
59
58
|
Scenario: Specify 2 line numbers where one is a tag
|
60
59
|
When I run cucumber -q features/sample.feature:5:14
|
61
60
|
Then it should fail with
|
@@ -117,6 +116,7 @@ Feature: Cucumber command line
|
|
117
116
|
|
118
117
|
"""
|
119
118
|
|
119
|
+
@mri186
|
120
120
|
Scenario: Run all with progress formatter
|
121
121
|
When I run cucumber -q --format progress features/sample.feature
|
122
122
|
Then it should fail with
|
@@ -406,6 +406,7 @@ Feature: Cucumber command line
|
|
406
406
|
|
407
407
|
"""
|
408
408
|
|
409
|
+
@mri186
|
409
410
|
Scenario: Run with a tag that exists on 1 feature
|
410
411
|
When I run cucumber -q features --tags one
|
411
412
|
Then it should fail with
|
@@ -2,6 +2,7 @@ Feature: Cucumber command line
|
|
2
2
|
In order to write better software
|
3
3
|
Developers should be able to execute requirements as tests
|
4
4
|
|
5
|
+
@mri186
|
5
6
|
Scenario: Run single failing scenario with default diff enabled
|
6
7
|
When I run cucumber -q features/failing_expectation.feature
|
7
8
|
Then it should fail with
|
@@ -25,6 +26,7 @@ Feature: Cucumber command line
|
|
25
26
|
|
26
27
|
"""
|
27
28
|
|
29
|
+
@mri186
|
28
30
|
Scenario: Run single failing scenario with diff output disabled
|
29
31
|
When I run cucumber -q --no-diff features/failing_expectation.feature
|
30
32
|
Then it should fail with
|
@@ -2,6 +2,7 @@ Feature: Cucumber command line
|
|
2
2
|
In order to write better software
|
3
3
|
Developers should be able to execute requirements as tests
|
4
4
|
|
5
|
+
@mri186
|
5
6
|
Scenario: Run scenario outline with filtering on outline name
|
6
7
|
When I run cucumber -q features --name "Test state"
|
7
8
|
Then it should fail with
|
@@ -31,6 +32,7 @@ Feature: Cucumber command line
|
|
31
32
|
|
32
33
|
"""
|
33
34
|
|
35
|
+
@mri186
|
34
36
|
Scenario: Run scenario outline steps only
|
35
37
|
When I run cucumber -q features/outline_sample.feature:7
|
36
38
|
Then it should fail with
|
@@ -60,6 +62,7 @@ Feature: Cucumber command line
|
|
60
62
|
|
61
63
|
"""
|
62
64
|
|
65
|
+
@mri186
|
63
66
|
Scenario: Run single failing scenario outline table row
|
64
67
|
When I run cucumber features/outline_sample.feature:12
|
65
68
|
Then it should fail with
|
@@ -85,7 +88,7 @@ Feature: Cucumber command line
|
|
85
88
|
|
86
89
|
# There are 10 characters in the progress, but only 8 reported steps. Needs investigation.
|
87
90
|
# Looks like we're outputting too many characters.
|
88
|
-
@
|
91
|
+
@mri186
|
89
92
|
Scenario: Run all with progress formatter
|
90
93
|
When I run cucumber -q --format progress features/outline_sample.feature
|
91
94
|
Then it should fail with
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Feature: --expand option
|
2
|
+
In order to make it easier to writhe certain editor plugins
|
3
|
+
and also for some people to understand scenarios, Cucumber
|
4
|
+
should expand examples in outlines.
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/expand_me.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: submit guess
|
11
|
+
Scenario Outline: submit guess
|
12
|
+
Given the secret code is <code>
|
13
|
+
When I guess <guess>
|
14
|
+
Then the mark should be <mark>
|
15
|
+
|
16
|
+
Examples: all colors correct
|
17
|
+
| code | guess | mark |
|
18
|
+
| r g y c | r g y c | bbbb |
|
19
|
+
| r g y c | r g c y | bbww |
|
20
|
+
"""
|
21
|
+
|
22
|
+
Scenario: Expand the outline
|
23
|
+
When I run cucumber -i -q --expand features/expand_me.feature
|
24
|
+
Then it should pass with
|
25
|
+
"""
|
26
|
+
Feature: submit guess
|
27
|
+
|
28
|
+
Scenario Outline: submit guess
|
29
|
+
Given the secret code is <code>
|
30
|
+
When I guess <guess>
|
31
|
+
Then the mark should be <mark>
|
32
|
+
|
33
|
+
Examples: all colors correct
|
34
|
+
|
35
|
+
Scenario: | r g y c | r g y c | bbbb |
|
36
|
+
Given the secret code is r g y c
|
37
|
+
When I guess r g y c
|
38
|
+
Then the mark should be bbbb
|
39
|
+
|
40
|
+
Scenario: | r g y c | r g c y | bbww |
|
41
|
+
Given the secret code is r g y c
|
42
|
+
When I guess r g c y
|
43
|
+
Then the mark should be bbww
|
44
|
+
|
45
|
+
2 scenarios (2 undefined)
|
46
|
+
6 steps (6 undefined)
|
47
|
+
|
48
|
+
"""
|
@@ -5,7 +5,8 @@ Feature: JUnit output formatter
|
|
5
5
|
Background:
|
6
6
|
Given I am in junit
|
7
7
|
And the tmp directory is empty
|
8
|
-
|
8
|
+
|
9
|
+
@mri186 @diffxml
|
9
10
|
Scenario: one feature, one passing scenario, one failing scenario
|
10
11
|
When I run cucumber --format junit --out tmp/ features/one_passing_one_failing.feature
|
11
12
|
Then it should fail with
|
@@ -27,6 +28,8 @@ Feature: JUnit output formatter
|
|
27
28
|
</testsuite>
|
28
29
|
|
29
30
|
"""
|
31
|
+
|
32
|
+
@mri186 @diffxml
|
30
33
|
Scenario: pending step
|
31
34
|
When I run cucumber --format junit --out tmp/ features/pending.feature
|
32
35
|
Then it should pass with
|
@@ -2,6 +2,7 @@ Feature: Cucumber command line
|
|
2
2
|
In order to find out what step definitions need to be implemented
|
3
3
|
Developers should always see what step definition is missing
|
4
4
|
|
5
|
+
@mri186
|
5
6
|
Scenario: Get info at arbitrary levels of nesting
|
6
7
|
When I run cucumber features/call_undefined_step_from_step_def.feature
|
7
8
|
Then it should pass with
|
@@ -66,13 +66,13 @@ Then /^the output should be$/ do |text|
|
|
66
66
|
last_stdout.should == text
|
67
67
|
end
|
68
68
|
|
69
|
-
# http://diffxml.sourceforge.net/
|
70
69
|
Then /^"(.*)" should contain XML$/ do |file, xml|
|
71
70
|
t = Tempfile.new('cucumber-junit')
|
72
71
|
t.write(xml)
|
73
72
|
t.flush
|
74
73
|
t.close
|
75
|
-
|
74
|
+
cmd = "diffxml #{t.path} #{file}"
|
75
|
+
diff = `#{cmd}`
|
76
76
|
if diff =~ /<delta>/m
|
77
77
|
raise diff + "\nXML WAS:\n" + IO.read(file)
|
78
78
|
end
|
data/features/support/env.rb
CHANGED
data/features/usage.feature
CHANGED
@@ -3,43 +3,38 @@ Feature: Cucumber command line
|
|
3
3
|
steps and step definitions, Cucumber must provide a way to
|
4
4
|
display how they are related.
|
5
5
|
|
6
|
+
@mri186
|
6
7
|
Scenario: List usage of step definitions
|
7
8
|
When I run cucumber features --format usage --dry-run
|
8
9
|
Then it should pass with
|
9
10
|
"""
|
10
11
|
/^passing without a table$/ # features/step_definitions/sample_steps.rb:12
|
11
|
-
Given
|
12
|
-
Given passing without a table # features/background/failing_background_after_success.feature:4
|
13
|
-
Given passing without a table # features/multiline_name.feature:6
|
14
|
-
Given passing without a table # features/multiline_name.feature:11
|
12
|
+
Given <other_state> without a table # features/outline_sample.feature:7
|
15
13
|
Given <state> without a table # features/multiline_name.feature:16
|
16
14
|
Given <state> without a table # features/multiline_name.feature:22
|
17
15
|
Given <state> without a table # features/outline_sample.feature:6
|
18
|
-
Given <other_state> without a table # features/outline_sample.feature:7
|
19
|
-
Given passing without a table # features/search_sample.feature:4
|
20
|
-
Given passing without a table # features/search_sample.feature:7
|
21
16
|
Given <state> without a table # features/search_sample.feature:19
|
22
17
|
Given <state> without a table # features/search_sample.feature:25
|
18
|
+
Given passing without a table # features/background/background_tagged_before_on_outline.feature:5
|
19
|
+
Given passing without a table # features/background/failing_background_after_success.feature:4
|
20
|
+
Given passing without a table # features/multiline_name.feature:11
|
21
|
+
Given passing without a table # features/multiline_name.feature:6
|
22
|
+
Given passing without a table # features/search_sample.feature:4
|
23
|
+
Given passing without a table # features/search_sample.feature:7
|
23
24
|
/^failing without a table$/ # features/step_definitions/sample_steps.rb:15
|
25
|
+
Given <state> without a table # features/search_sample.feature:13
|
24
26
|
Given failing without a table # features/background/failing_background.feature:5
|
25
27
|
Given failing without a table # features/background/scenario_outline_failing_background.feature:4
|
26
28
|
Given failing without a table # features/search_sample.feature:10
|
27
|
-
Given <state> without a table # features/search_sample.feature:13
|
28
29
|
/^a step definition that calls an undefined step$/ # features/step_definitions/sample_steps.rb:19
|
29
30
|
Given a step definition that calls an undefined step # features/call_undefined_step_from_step_def.feature:4
|
30
31
|
/^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
|
31
32
|
Given call step "a step definition that calls an undefined step" # features/call_undefined_step_from_step_def.feature:7
|
32
33
|
/^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
|
33
|
-
Given '10' cukes # features/background/background_with_name.feature:4
|
34
34
|
And '10' cukes # features/background/failing_background.feature:6
|
35
|
+
Given '10' cukes # features/background/background_with_name.feature:4
|
35
36
|
Given '10' cukes # features/background/passing_background.feature:4
|
36
37
|
Given '10' cukes # features/background/scenario_outline_passing_background.feature:4
|
37
|
-
Given '2' cukes # features/tons_of_cukes.feature:4
|
38
|
-
Given '2' cukes # features/tons_of_cukes.feature:5
|
39
|
-
Given '2' cukes # features/tons_of_cukes.feature:6
|
40
|
-
Given '2' cukes # features/tons_of_cukes.feature:7
|
41
|
-
Given '2' cukes # features/tons_of_cukes.feature:8
|
42
|
-
Given '2' cukes # features/tons_of_cukes.feature:9
|
43
38
|
Given '2' cukes # features/tons_of_cukes.feature:10
|
44
39
|
Given '2' cukes # features/tons_of_cukes.feature:11
|
45
40
|
Given '2' cukes # features/tons_of_cukes.feature:12
|
@@ -70,6 +65,7 @@ Feature: Cucumber command line
|
|
70
65
|
Given '2' cukes # features/tons_of_cukes.feature:37
|
71
66
|
Given '2' cukes # features/tons_of_cukes.feature:38
|
72
67
|
Given '2' cukes # features/tons_of_cukes.feature:39
|
68
|
+
Given '2' cukes # features/tons_of_cukes.feature:4
|
73
69
|
Given '2' cukes # features/tons_of_cukes.feature:40
|
74
70
|
Given '2' cukes # features/tons_of_cukes.feature:41
|
75
71
|
Given '2' cukes # features/tons_of_cukes.feature:42
|
@@ -80,27 +76,32 @@ Feature: Cucumber command line
|
|
80
76
|
Given '2' cukes # features/tons_of_cukes.feature:47
|
81
77
|
Given '2' cukes # features/tons_of_cukes.feature:48
|
82
78
|
Given '2' cukes # features/tons_of_cukes.feature:49
|
79
|
+
Given '2' cukes # features/tons_of_cukes.feature:5
|
83
80
|
Given '2' cukes # features/tons_of_cukes.feature:50
|
84
81
|
Given '2' cukes # features/tons_of_cukes.feature:51
|
85
82
|
Given '2' cukes # features/tons_of_cukes.feature:52
|
83
|
+
Given '2' cukes # features/tons_of_cukes.feature:6
|
84
|
+
Given '2' cukes # features/tons_of_cukes.feature:7
|
85
|
+
Given '2' cukes # features/tons_of_cukes.feature:8
|
86
|
+
Given '2' cukes # features/tons_of_cukes.feature:9
|
86
87
|
/^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
|
87
|
-
Then I should have '<count>' cukes # features/background/background_tagged_before_on_outline.feature:8
|
88
88
|
Then I should have '10' cukes # features/background/background_with_name.feature:7
|
89
|
-
Then I should have '10' cukes # features/background/failing_background.feature:9
|
90
89
|
Then I should have '10' cukes # features/background/failing_background.feature:12
|
91
|
-
Then I should have '10' cukes # features/background/
|
90
|
+
Then I should have '10' cukes # features/background/failing_background.feature:9
|
92
91
|
Then I should have '10' cukes # features/background/passing_background.feature:10
|
93
|
-
Then I should have '10' cukes # features/background/
|
92
|
+
Then I should have '10' cukes # features/background/passing_background.feature:7
|
94
93
|
Then I should have '10' cukes # features/background/pending_background.feature:10
|
95
|
-
Then I should have '
|
94
|
+
Then I should have '10' cukes # features/background/pending_background.feature:7
|
95
|
+
Then I should have '<count>' cukes # features/background/background_tagged_before_on_outline.feature:8
|
96
96
|
Then I should have '<count>' cukes # features/background/scenario_outline_failing_background.feature:13
|
97
|
-
Then I should have '<count>' cukes # features/background/
|
97
|
+
Then I should have '<count>' cukes # features/background/scenario_outline_failing_background.feature:7
|
98
98
|
Then I should have '<count>' cukes # features/background/scenario_outline_passing_background.feature:13
|
99
|
+
Then I should have '<count>' cukes # features/background/scenario_outline_passing_background.feature:7
|
99
100
|
/^'(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:35
|
100
101
|
And '10' global cukes # features/background/failing_background_after_success.feature:5
|
101
102
|
/^I should have '(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:42
|
102
|
-
Then I should have '10' global cukes # features/background/failing_background_after_success.feature:8
|
103
103
|
Then I should have '10' global cukes # features/background/failing_background_after_success.feature:11
|
104
|
+
Then I should have '10' global cukes # features/background/failing_background_after_success.feature:8
|
104
105
|
/^table$/ # features/step_definitions/sample_steps.rb:46
|
105
106
|
Given table # features/background/multiline_args_background.feature:4
|
106
107
|
/^multiline string$/ # features/step_definitions/sample_steps.rb:50
|
@@ -49,6 +49,7 @@ Feature: Cucumber --work-in-progress switch
|
|
49
49
|
end
|
50
50
|
"""
|
51
51
|
|
52
|
+
@mri186
|
52
53
|
Scenario: Pass with Failing Scenarios
|
53
54
|
When I run cucumber -q -w -t @failing features/wip.feature
|
54
55
|
Then it should pass with
|
@@ -82,6 +83,7 @@ Feature: Cucumber --work-in-progress switch
|
|
82
83
|
|
83
84
|
"""
|
84
85
|
|
86
|
+
@mri186
|
85
87
|
Scenario: Pass with Undefined Scenarios
|
86
88
|
When I run cucumber -q -w -t @pending features/wip.feature
|
87
89
|
Then it should pass with
|
data/gem_tasks/rspec.rake
CHANGED
@@ -27,10 +27,17 @@ if require_spec
|
|
27
27
|
unable_to_load
|
28
28
|
end
|
29
29
|
|
30
|
+
def undefine_task(*names)
|
31
|
+
app = Rake.application
|
32
|
+
tasks = app.instance_variable_get('@tasks')
|
33
|
+
names.flatten.each { |name| tasks.delete(name) }
|
34
|
+
end
|
35
|
+
undefine_task('spec') # Hoe 1.2.12 is broken - it defines a spec task that we can't tweak.
|
36
|
+
|
30
37
|
desc "Run the Cucumber specs"
|
31
38
|
Spec::Rake::SpecTask.new do |t|
|
32
|
-
t.spec_opts = ['--options', "
|
33
|
-
t.spec_files = FileList['
|
39
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
40
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
34
41
|
t.rcov = ENV['RCOV']
|
35
42
|
t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/}
|
36
43
|
t.verbose = true
|
data/lib/cucumber.rb
CHANGED
@@ -39,6 +39,10 @@ module Cucumber
|
|
39
39
|
def keyword_hash(lang=@lang)
|
40
40
|
LANGUAGES[lang]
|
41
41
|
end
|
42
|
+
|
43
|
+
def scenario_keyword
|
44
|
+
keyword_hash['scenario'].split('|')[0] + ':'
|
45
|
+
end
|
42
46
|
|
43
47
|
def alias_step_definitions(lang) #:nodoc:
|
44
48
|
keywords = %w{given when then and but}.map{|keyword| keyword_hash(lang)[keyword].split('|')}
|
@@ -10,7 +10,11 @@ module Cucumber
|
|
10
10
|
|
11
11
|
def accept(visitor)
|
12
12
|
cells_rows.each_with_index do |row, n|
|
13
|
-
visitor.
|
13
|
+
if(visitor.options[:expand])
|
14
|
+
row.accept(visitor)
|
15
|
+
else
|
16
|
+
visitor.visit_table_row(row)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
nil
|
16
20
|
end
|
@@ -35,6 +39,10 @@ module Cucumber
|
|
35
39
|
cells_rows[1..-1]
|
36
40
|
end
|
37
41
|
|
42
|
+
def visit_scenario_name(visitor, row)
|
43
|
+
@scenario_outline.visit_scenario_name(visitor, row)
|
44
|
+
end
|
45
|
+
|
38
46
|
class ExampleCells < Cells
|
39
47
|
|
40
48
|
def create_step_invocations!(scenario_outline)
|
@@ -49,6 +57,10 @@ module Cucumber
|
|
49
57
|
end
|
50
58
|
|
51
59
|
def accept(visitor)
|
60
|
+
visitor.options[:expand] ? accept_expand(visitor) : accept_plain(visitor)
|
61
|
+
end
|
62
|
+
|
63
|
+
def accept_plain(visitor)
|
52
64
|
if header?
|
53
65
|
@cells.each do |cell|
|
54
66
|
cell.status = :skipped_param
|
@@ -70,6 +82,20 @@ module Cucumber
|
|
70
82
|
end
|
71
83
|
end
|
72
84
|
|
85
|
+
def accept_expand(visitor)
|
86
|
+
if header?
|
87
|
+
else
|
88
|
+
visitor.step_mother.before_and_after(self) do
|
89
|
+
@table.visit_scenario_name(visitor, self)
|
90
|
+
@step_invocations.each do |step_invocation|
|
91
|
+
step_invocation.invoke(visitor.step_mother, visitor.options)
|
92
|
+
@exception ||= step_invocation.exception
|
93
|
+
step_invocation.visit_step_result(visitor)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
73
99
|
def accept_hook?(hook)
|
74
100
|
@table.accept_hook?(hook)
|
75
101
|
end
|
@@ -99,10 +125,13 @@ module Cucumber
|
|
99
125
|
end
|
100
126
|
|
101
127
|
def backtrace_line
|
102
|
-
name = "| #{@cells.collect{|c| c.value }.join(' | ')} |"
|
103
128
|
@scenario_outline.backtrace_line(name, line)
|
104
129
|
end
|
105
130
|
|
131
|
+
def name
|
132
|
+
"| #{@cells.collect{|c| c.value }.join(' | ')} |"
|
133
|
+
end
|
134
|
+
|
106
135
|
private
|
107
136
|
|
108
137
|
def header?
|
@@ -61,6 +61,10 @@ module Cucumber
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
def visit_scenario_name(visitor, row)
|
65
|
+
visitor.visit_scenario_name(Cucumber.scenario_keyword, row.name, file_colon_line(row.line), source_indent(first_line_length))
|
66
|
+
end
|
67
|
+
|
64
68
|
def to_sexp
|
65
69
|
sexp = [:scenario_outline, @keyword, @name]
|
66
70
|
comment = @comment.to_sexp
|
data/lib/cucumber/ast/step.rb
CHANGED
@@ -51,7 +51,7 @@ module Cucumber
|
|
51
51
|
step_match = visitor.step_mother.step_match(name, @name) rescue nil
|
52
52
|
return step_match if step_match
|
53
53
|
end
|
54
|
-
NoStepMatch.new(self)
|
54
|
+
NoStepMatch.new(self, @name)
|
55
55
|
end
|
56
56
|
|
57
57
|
def to_sexp
|
@@ -62,8 +62,8 @@ module Cucumber
|
|
62
62
|
@feature_element.source_indent(text_length)
|
63
63
|
end
|
64
64
|
|
65
|
-
def text_length
|
66
|
-
@keyword.jlength +
|
65
|
+
def text_length(name=@name)
|
66
|
+
@keyword.jlength + name.jlength + INDENT # Add indent as steps get indented more than scenarios
|
67
67
|
end
|
68
68
|
|
69
69
|
def backtrace_line
|
@@ -20,7 +20,11 @@ module Cucumber
|
|
20
20
|
|
21
21
|
def accept(visitor)
|
22
22
|
invoke(visitor.step_mother, visitor.options)
|
23
|
-
|
23
|
+
visit_step_result(visitor)
|
24
|
+
end
|
25
|
+
|
26
|
+
def visit_step_result(visitor)
|
27
|
+
visitor.visit_step_result(keyword, @step_match, @multiline_arg, @status, @exception, source_indent, @background)
|
24
28
|
end
|
25
29
|
|
26
30
|
def invoke(step_mother, options)
|
@@ -52,11 +56,11 @@ module Cucumber
|
|
52
56
|
rescue Undefined => e
|
53
57
|
failed(e, true)
|
54
58
|
status!(:undefined)
|
55
|
-
@step_match = NoStepMatch.new(@step)
|
59
|
+
@step_match = NoStepMatch.new(@step, @name)
|
56
60
|
rescue Ambiguous => e
|
57
61
|
failed(e, false)
|
58
62
|
status!(:failed)
|
59
|
-
@step_match = NoStepMatch.new(@step)
|
63
|
+
@step_match = NoStepMatch.new(@step, @name)
|
60
64
|
end
|
61
65
|
step_mother.step_visited(self)
|
62
66
|
end
|
@@ -86,8 +90,12 @@ module Cucumber
|
|
86
90
|
end
|
87
91
|
end
|
88
92
|
|
93
|
+
def source_indent
|
94
|
+
@step.feature_element.source_indent(text_length)
|
95
|
+
end
|
96
|
+
|
89
97
|
def text_length
|
90
|
-
@step.text_length
|
98
|
+
@step.text_length(@name)
|
91
99
|
end
|
92
100
|
|
93
101
|
def keyword
|
@@ -152,6 +152,9 @@ module Cucumber
|
|
152
152
|
opts.on("-g", "--guess", "Guess best match for Ambiguous steps.") do
|
153
153
|
@options[:guess] = true
|
154
154
|
end
|
155
|
+
opts.on("-x", "--expand", "Expand Scenario Outline Tables in output.") do
|
156
|
+
@options[:expand] = true
|
157
|
+
end
|
155
158
|
opts.on("--no-diff", "Disable diff output on failing expectations.") do
|
156
159
|
@options[:diff_enabled] = false
|
157
160
|
end
|
@@ -76,6 +76,7 @@ module Cucumber
|
|
76
76
|
|
77
77
|
def visit_feature_element(feature_element)
|
78
78
|
@indent = 2
|
79
|
+
@scenario_indent = 2
|
79
80
|
super
|
80
81
|
@io.puts
|
81
82
|
@io.flush
|
@@ -83,6 +84,7 @@ module Cucumber
|
|
83
84
|
|
84
85
|
def visit_background(background)
|
85
86
|
@indent = 2
|
87
|
+
@scenario_indent = 2
|
86
88
|
@in_background = true
|
87
89
|
super
|
88
90
|
@in_background = nil
|
@@ -100,6 +102,7 @@ module Cucumber
|
|
100
102
|
names[1..-1].each {|s| @io.puts " #{s}" }
|
101
103
|
@io.flush
|
102
104
|
@indent = 6
|
105
|
+
@scenario_indent = 6
|
103
106
|
end
|
104
107
|
|
105
108
|
def visit_scenario_name(keyword, name, file_colon_line, source_indent)
|
@@ -107,8 +110,9 @@ module Cucumber
|
|
107
110
|
end
|
108
111
|
|
109
112
|
def visit_feature_element_name(keyword, name, file_colon_line, source_indent)
|
113
|
+
@io.puts if @scenario_indent == 6
|
110
114
|
names = name.empty? ? [name] : name.split("\n")
|
111
|
-
line = "
|
115
|
+
line = "#{keyword} #{names[0]}".indent(@scenario_indent)
|
112
116
|
@io.print(line)
|
113
117
|
if @options[:source]
|
114
118
|
line_comment = " # #{file_colon_line}".indent(source_indent)
|
@@ -137,7 +141,7 @@ module Cucumber
|
|
137
141
|
def visit_step_name(keyword, step_match, status, source_indent, background)
|
138
142
|
source_indent = nil unless @options[:source]
|
139
143
|
formatted_step_name = format_step(keyword, step_match, status, source_indent)
|
140
|
-
@io.puts(
|
144
|
+
@io.puts(formatted_step_name.indent(@scenario_indent + 2))
|
141
145
|
end
|
142
146
|
|
143
147
|
def visit_multiline_arg(multiline_arg)
|
@@ -56,14 +56,14 @@ module Cucumber
|
|
56
56
|
|
57
57
|
@io.print step_definition.regexp.inspect
|
58
58
|
@io.puts format_string(" # #{step_definition.file_colon_line}".indent(max_length - step_definition.text_length), :comment)
|
59
|
-
step_matches_and_descriptions.
|
59
|
+
da = step_matches_and_descriptions.map do |step_match_and_description|
|
60
60
|
step_match = step_match_and_description[0]
|
61
61
|
description = step_match_and_description[1]
|
62
62
|
length = step_match_and_description[2]
|
63
63
|
file_colon_line = step_match_and_description[3]
|
64
|
-
|
65
|
-
@io.puts format_string(" # #{file_colon_line}".indent(max_length - length), :comment)
|
64
|
+
" #{description}" + format_string(" # #{file_colon_line}".indent(max_length - length), :comment)
|
66
65
|
end
|
66
|
+
da.sort.each{|d| puts d}
|
67
67
|
end
|
68
68
|
|
69
69
|
print_unused_step_definitions
|
data/lib/cucumber/languages.yml
CHANGED
@@ -62,12 +62,12 @@
|
|
62
62
|
name: Catalan
|
63
63
|
native: català
|
64
64
|
encoding: UTF-8
|
65
|
-
background: Rerefons
|
65
|
+
background: Rerefons|Antecedents
|
66
66
|
feature: Característica
|
67
67
|
scenario: Escenari
|
68
68
|
scenario_outline: Esquema de l\'escenari
|
69
69
|
examples: Exemples
|
70
|
-
given: Donat
|
70
|
+
given: Donat|Donada
|
71
71
|
when: Quan
|
72
72
|
then: Aleshores
|
73
73
|
and: I
|
data/lib/cucumber/rake/task.rb
CHANGED
@@ -171,7 +171,7 @@ module Cucumber
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def runner(task_args = nil) # :nodoc:
|
174
|
-
cucumber_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts_with_profile
|
174
|
+
cucumber_opts = [(ENV['CUCUMBER_OPTS'] ? ENV['CUCUMBER_OPTS'].split(/\s+/) : nil) || cucumber_opts_with_profile]
|
175
175
|
if(@rcov)
|
176
176
|
RCovCucumberRunner.new(libs, binary, cucumber_opts, feature_files(task_args), rcov_opts)
|
177
177
|
elsif(@fork)
|
data/lib/cucumber/step_match.rb
CHANGED
@@ -33,12 +33,13 @@ module Cucumber
|
|
33
33
|
class NoStepMatch
|
34
34
|
attr_reader :step_definition
|
35
35
|
|
36
|
-
def initialize(step)
|
36
|
+
def initialize(step, name)
|
37
37
|
@step = step
|
38
|
+
@name = name
|
38
39
|
end
|
39
40
|
|
40
41
|
def format_args(format)
|
41
|
-
@
|
42
|
+
@name
|
42
43
|
end
|
43
44
|
|
44
45
|
def file_colon_line
|
data/lib/cucumber/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Aslak Helles\xC3\xB8y"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-22 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -322,6 +322,7 @@ files:
|
|
322
322
|
- features/cucumber_cli_outlines.feature
|
323
323
|
- features/custom_formatter.feature
|
324
324
|
- features/exclude_files.feature
|
325
|
+
- features/expand.feature
|
325
326
|
- features/junit_formatter.feature
|
326
327
|
- features/multiline_names.feature
|
327
328
|
- features/rake_task.feature
|