cucumber 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. data/History.txt +16 -0
  2. data/Manifest.txt +6 -0
  3. data/examples/i18n/he/Rakefile +6 -0
  4. data/examples/i18n/he/features/addition.feature +16 -0
  5. data/examples/i18n/he/features/division.feature +9 -0
  6. data/examples/i18n/he/features/step_definitons/calculator_steps.rb +24 -0
  7. data/examples/i18n/he/lib/calculator.rb +14 -0
  8. data/examples/self_test/features/search_sample.feature +10 -0
  9. data/examples/watir/features/search.feature +4 -1
  10. data/examples/watir/features/step_definitons/search_steps.rb +2 -4
  11. data/features/background.feature +30 -35
  12. data/features/cucumber_cli.feature +78 -68
  13. data/features/cucumber_cli_diff_disabled.feature +4 -4
  14. data/features/cucumber_cli_outlines.feature +43 -53
  15. data/features/multiline_names.feature +10 -10
  16. data/features/rake_task.feature +104 -86
  17. data/features/report_called_undefined_steps.feature +2 -2
  18. data/features/step_definitions/cucumber_steps.rb +8 -0
  19. data/features/usage.feature +1 -0
  20. data/lib/cucumber/ast/outline_table.rb +5 -0
  21. data/lib/cucumber/ast/scenario.rb +5 -0
  22. data/lib/cucumber/ast/step_collection.rb +7 -2
  23. data/lib/cucumber/ast/table.rb +1 -1
  24. data/lib/cucumber/formatter/console.rb +15 -9
  25. data/lib/cucumber/formatter/pretty.rb +3 -3
  26. data/lib/cucumber/formatter/progress.rb +8 -9
  27. data/lib/cucumber/languages.yml +16 -1
  28. data/lib/cucumber/parser/feature.rb +9 -2
  29. data/lib/cucumber/parser/feature.tt +13 -5
  30. data/lib/cucumber/parser/treetop_ext.rb +9 -0
  31. data/lib/cucumber/rails/world.rb +7 -1
  32. data/lib/cucumber/rake/task.rb +2 -0
  33. data/lib/cucumber/step_mother.rb +6 -1
  34. data/lib/cucumber/version.rb +1 -1
  35. data/spec/cucumber/ast/table_spec.rb +1 -1
  36. data/spec/cucumber/formatter/progress_spec.rb +35 -0
  37. data/spec/cucumber/parser/feature_parser_spec.rb +12 -0
  38. metadata +8 -2
@@ -20,8 +20,8 @@ Feature: Cucumber command line
20
20
  ./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
21
21
  features/failing_expectation.feature:4:in `Given failing expectation'
22
22
 
23
- 1 scenario
24
- 1 failed step
23
+ 1 scenario (1 failed)
24
+ 1 step (1 failed)
25
25
 
26
26
  """
27
27
 
@@ -38,8 +38,8 @@ Feature: Cucumber command line
38
38
  ./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
39
39
  features/failing_expectation.feature:4:in `Given failing expectation'
40
40
 
41
- 1 scenario
42
- 1 failed step
41
+ 1 scenario (1 failed)
42
+ 1 step (1 failed)
43
43
 
44
44
  """
45
45
 
@@ -12,25 +12,22 @@ Feature: Cucumber command line
12
12
  Given <state> without a table
13
13
  Given <other_state> without a table
14
14
 
15
- Examples: Rainbow colours
16
- | state | other_state |
17
- | missing | passing |
18
- | passing | passing |
19
- | failing | passing |
20
- FAIL (RuntimeError)
21
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
22
- ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
23
- features/outline_sample.feature:6:in `Given <state> without a table'
24
-
25
- Examples: Only passing
26
- | state | other_state |
27
- | passing | passing |
28
-
29
- 4 scenarios
30
- 1 failed step
31
- 2 skipped steps
32
- 1 undefined step
33
- 4 passed steps
15
+ Examples: Rainbow colours
16
+ | state | other_state |
17
+ | missing | passing |
18
+ | passing | passing |
19
+ | failing | passing |
20
+ FAIL (RuntimeError)
21
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
22
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
23
+ features/outline_sample.feature:6:in `Given <state> without a table'
24
+
25
+ Examples: Only passing
26
+ | state | other_state |
27
+ | passing | passing |
28
+
29
+ 4 scenarios (1 failed, 1 undefined, 2 passed)
30
+ 8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
34
31
 
35
32
  """
36
33
 
@@ -44,25 +41,22 @@ Feature: Cucumber command line
44
41
  Given <state> without a table
45
42
  Given <other_state> without a table
46
43
 
47
- Examples: Rainbow colours
48
- | state | other_state |
49
- | missing | passing |
50
- | passing | passing |
51
- | failing | passing |
52
- FAIL (RuntimeError)
53
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
54
- ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
55
- features/outline_sample.feature:6:in `Given <state> without a table'
56
-
57
- Examples: Only passing
58
- | state | other_state |
59
- | passing | passing |
60
-
61
- 4 scenarios
62
- 1 failed step
63
- 2 skipped steps
64
- 1 undefined step
65
- 4 passed steps
44
+ Examples: Rainbow colours
45
+ | state | other_state |
46
+ | missing | passing |
47
+ | passing | passing |
48
+ | failing | passing |
49
+ FAIL (RuntimeError)
50
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
51
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
52
+ features/outline_sample.feature:6:in `Given <state> without a table'
53
+
54
+ Examples: Only passing
55
+ | state | other_state |
56
+ | passing | passing |
57
+
58
+ 4 scenarios (1 failed, 1 undefined, 2 passed)
59
+ 8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
66
60
 
67
61
  """
68
62
 
@@ -76,17 +70,16 @@ Feature: Cucumber command line
76
70
  Given <state> without a table # features/step_definitions/sample_steps.rb:15
77
71
  Given <other_state> without a table # features/step_definitions/sample_steps.rb:12
78
72
 
79
- Examples: Rainbow colours
80
- | state | other_state |
81
- | failing | passing |
82
- FAIL (RuntimeError)
83
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
84
- ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
85
- features/outline_sample.feature:6:in `Given <state> without a table'
73
+ Examples: Rainbow colours
74
+ | state | other_state |
75
+ | failing | passing |
76
+ FAIL (RuntimeError)
77
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
78
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
79
+ features/outline_sample.feature:6:in `Given <state> without a table'
86
80
 
87
- 1 scenario
88
- 1 failed step
89
- 1 skipped step
81
+ 1 scenario (1 failed)
82
+ 2 steps (1 failed, 1 skipped)
90
83
 
91
84
  """
92
85
 
@@ -106,11 +99,8 @@ Feature: Cucumber command line
106
99
  ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
107
100
  features/outline_sample.feature:6:in `Given <state> without a table'
108
101
 
109
- 5 scenarios
110
- 1 failed step
111
- 2 skipped steps
112
- 1 undefined step
113
- 4 passed steps
102
+ 5 scenarios (1 failed, 1 undefined, 3 passed)
103
+ 8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
114
104
 
115
105
  """
116
106
 
@@ -24,20 +24,20 @@ Feature: Multiline description names
24
24
  yawn
25
25
  Given <state> without a table # features/step_definitions/sample_steps.rb:12
26
26
 
27
- Examples:
28
- | state |
29
- | passing |
27
+ Examples:
28
+ | state |
29
+ | passing |
30
30
 
31
31
  Scenario Outline: name # features/multiline_name.feature:21
32
32
  Given <state> without a table # features/step_definitions/sample_steps.rb:12
33
33
 
34
- Examples: I'm a multiline name
35
- which goes on and on and on for three lines
36
- yawn
37
- | state |
38
- | passing |
34
+ Examples: I'm a multiline name
35
+ which goes on and on and on for three lines
36
+ yawn
37
+ | state |
38
+ | passing |
39
39
 
40
- 3 scenarios
41
- 6 passed steps
40
+ 3 scenarios (3 passed)
41
+ 6 steps (6 passed)
42
42
 
43
43
  """
@@ -6,127 +6,145 @@ Feature: Rake task
6
6
  Background:
7
7
  Given a standard Cucumber project directory structure
8
8
  And a file named "features/missing_step_definitions.feature" with:
9
- """
10
- Feature: Sample
9
+ """
10
+ Feature: Sample
11
11
 
12
- Scenario: Wanted
13
- Given I want to run this
12
+ Scenario: Wanted
13
+ Given I want to run this
14
14
 
15
- Scenario: Unwanted
16
- Given I don't want this ran
17
- """
15
+ Scenario: Unwanted
16
+ Given I don't want this ran
17
+ """
18
18
 
19
19
 
20
20
  Scenario: rake task with a defined profile
21
21
  Given the following profile is defined:
22
- """
23
- foo: --quiet --no-color features/missing_step_definitions.feature:3
24
- """
22
+ """
23
+ foo: --quiet --no-color features/missing_step_definitions.feature:3
24
+ """
25
25
  And a file named "Rakefile" with:
26
- """
27
- $LOAD_PATH.unshift(CUCUMBER_LIB)
28
- require 'cucumber/rake/task'
29
-
30
- Cucumber::Rake::Task.new(:features) do |t|
31
- t.profile = "foo"
32
- end
33
- """
34
-
26
+ """
27
+ $LOAD_PATH.unshift(CUCUMBER_LIB)
28
+ require 'cucumber/rake/task'
29
+
30
+ Cucumber::Rake::Task.new(:features) do |t|
31
+ t.profile = "foo"
32
+ end
33
+ """
35
34
  When I run rake features
36
35
  Then it should pass
37
36
  And the output should contain
38
- """
39
- Feature: Sample
37
+ """
38
+ Feature: Sample
40
39
 
41
- Scenario: Wanted
42
- Given I want to run this
40
+ Scenario: Wanted
41
+ Given I want to run this
43
42
 
44
- 1 scenario
45
- 1 undefined step
46
- """
43
+ 1 scenario (1 undefined)
44
+ 1 step (1 undefined)
45
+ """
47
46
 
48
47
  Scenario: rake task with a defined profile and cucumber_opts
49
48
  Given the following profile is defined:
50
- """
51
- bar: features/missing_step_definitions.feature:3
52
- """
49
+ """
50
+ bar: features/missing_step_definitions.feature:3
51
+ """
53
52
  And a file named "Rakefile" with:
54
- """
55
- $LOAD_PATH.unshift(CUCUMBER_LIB)
56
- require 'cucumber/rake/task'
57
-
58
- Cucumber::Rake::Task.new(:features) do |t|
59
- t.profile = "bar"
60
- t.cucumber_opts = "--quiet --no-color"
61
- end
62
- """
63
-
53
+ """
54
+ $LOAD_PATH.unshift(CUCUMBER_LIB)
55
+ require 'cucumber/rake/task'
56
+
57
+ Cucumber::Rake::Task.new(:features) do |t|
58
+ t.profile = "bar"
59
+ t.cucumber_opts = "--quiet --no-color"
60
+ end
61
+ """
64
62
  When I run rake features
65
63
  Then it should pass
66
64
  And the output should contain
67
- """
68
- Feature: Sample
65
+ """
66
+ Feature: Sample
69
67
 
70
- Scenario: Wanted
71
- Given I want to run this
68
+ Scenario: Wanted
69
+ Given I want to run this
72
70
 
73
- 1 scenario
74
- 1 undefined step
75
- """
71
+ 1 scenario (1 undefined)
72
+ 1 step (1 undefined)
73
+ """
76
74
 
77
75
  Scenario: rake task with a defined profile and feature list
78
76
  Given a file named "features/the_one_i_want_to_run.feature" with:
79
- """
80
- Feature: Desired
81
-
82
- Scenario: Something
83
- Given this is missing
84
- """
85
- Given the following profile is defined:
86
- """
87
- baz: --quiet --no-color
88
- """
89
- And a file named "Rakefile" with:
90
- """
91
- $LOAD_PATH.unshift(CUCUMBER_LIB)
92
- require 'cucumber/rake/task'
93
-
94
- Cucumber::Rake::Task.new(:features) do |t|
95
- t.profile = "baz"
96
- t.feature_list = ['features/the_one_i_want_to_run.feature']
97
- end
98
- """
77
+ """
78
+ Feature: Desired
99
79
 
80
+ Scenario: Something
81
+ Given this is missing
82
+ """
83
+ Given the following profile is defined:
84
+ """
85
+ baz: --quiet --no-color
86
+ """
87
+ And a file named "Rakefile" with:
88
+ """
89
+ $LOAD_PATH.unshift(CUCUMBER_LIB)
90
+ require 'cucumber/rake/task'
91
+
92
+ Cucumber::Rake::Task.new(:features) do |t|
93
+ t.profile = "baz"
94
+ t.feature_list = ['features/the_one_i_want_to_run.feature']
95
+ end
96
+ """
100
97
  When I run rake features
101
98
  Then it should pass
102
99
  And the output should contain
103
- """
104
- Feature: Desired
100
+ """
101
+ Feature: Desired
105
102
 
106
- Scenario: Something
107
- Given this is missing
103
+ Scenario: Something
104
+ Given this is missing
108
105
 
109
- 1 scenario
110
- 1 undefined step
111
- """
106
+ 1 scenario (1 undefined)
107
+ 1 step (1 undefined)
108
+ """
112
109
 
113
110
  Scenario: deprecation warnings
114
111
  Given a file named "Rakefile" with:
115
- """
116
- $LOAD_PATH.unshift(CUCUMBER_LIB)
117
- require 'cucumber/rake/task'
118
-
119
- Cucumber::Rake::Task.new(:features) do |t|
120
- t.feature_list = ['features/missing_step_definitions.feature']
121
- end
122
- """
112
+ """
113
+ $LOAD_PATH.unshift(CUCUMBER_LIB)
114
+ require 'cucumber/rake/task'
115
+
116
+ Cucumber::Rake::Task.new(:features) do |t|
117
+ t.feature_list = ['features/missing_step_definitions.feature']
118
+ end
119
+ """
123
120
  When I run rake features
124
121
  Then it should pass
125
122
  And STDERR should match
126
- """
127
- Cucumber::Rake::Task#feature_list is deprecated and will be removed in 0.4.0. Please use profiles for complex settings: http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles
128
- """
129
-
130
-
123
+ """
124
+ Cucumber::Rake::Task#feature_list is deprecated and will be removed in 0.4.0. Please use profiles for complex settings: http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles
125
+ """
126
+
127
+ Scenario: respect requires
128
+ Given a file named "features/support/env.rb"
129
+ And a file named "features/support/dont_require_me.rb"
130
+ And the following profile is defined:
131
+ """
132
+ no_bomb: features/missing_step_definitions.feature:3 --require features/support/env.rb --verbose
133
+ """
134
+ And a file named "Rakefile" with:
135
+ """
136
+ $LOAD_PATH.unshift(CUCUMBER_LIB)
137
+ require 'cucumber/rake/task'
131
138
 
139
+ Cucumber::Rake::Task.new(:features) do |t|
140
+ t.profile = "no_bomb"
141
+ t.cucumber_opts = "--quiet --no-color"
142
+ end
143
+ """
132
144
 
145
+ When I run rake features
146
+ Then it should pass
147
+ And the output should not contain
148
+ """
149
+ * features/support/dont_require_me.rb
150
+ """
@@ -20,8 +20,8 @@ Feature: Cucumber command line
20
20
  ./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
21
21
  features/call_undefined_step_from_step_def.feature:7:in `Given call step "a step definition that calls an undefined step"'
22
22
 
23
- 2 scenarios
24
- 2 undefined steps
23
+ 2 scenarios (2 undefined)
24
+ 2 steps (2 undefined)
25
25
 
26
26
  You can implement step definitions for undefined steps with these snippets:
27
27
 
@@ -10,6 +10,10 @@ Given /^a standard Cucumber project directory structure$/ do
10
10
  end
11
11
  end
12
12
 
13
+ Given /^a file named "([^\"]*)"$/ do |file_name|
14
+ create_file(file_name, '')
15
+ end
16
+
13
17
  Given /^a file named "([^\"]*)" with:$/ do |file_name, file_content|
14
18
  create_file(file_name, file_content)
15
19
  end
@@ -43,6 +47,10 @@ Then /^the output should contain$/ do |text|
43
47
  last_stdout.should include(text)
44
48
  end
45
49
 
50
+ Then /^the output should not contain$/ do |text|
51
+ last_stdout.should_not include(text)
52
+ end
53
+
46
54
  Then /^"(.*)" should contain$/ do |file, text|
47
55
  IO.read(file).should == text
48
56
  end
@@ -18,6 +18,7 @@ Feature: Cucumber command line
18
18
  Given passing without a table # features/search_sample.feature:4
19
19
  Given passing without a table # features/search_sample.feature:7
20
20
  Given <state> without a table # features/search_sample.feature:19
21
+ Given <state> without a table # features/search_sample.feature:25
21
22
  /^failing without a table$/ # features/step_definitions/sample_steps.rb:15
22
23
  Given failing without a table # features/background/failing_background.feature:5
23
24
  Given failing without a table # features/background/scenario_outline_failing_background.feature:4