cucumber 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. data/.rspec +1 -1
  2. data/Caliper.yml +4 -0
  3. data/History.txt +1557 -0
  4. data/LICENSE +1 -1
  5. data/README.rdoc +26 -0
  6. data/Rakefile +51 -5
  7. data/VERSION.yml +5 -0
  8. data/bin/cucumber +1 -7
  9. data/cucumber.gemspec +77 -3
  10. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
  11. data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
  12. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +7 -4
  13. data/examples/i18n/ro/features/suma.feature +11 -0
  14. data/examples/i18n/ru/features/division.feature +2 -2
  15. data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
  16. data/examples/sinatra/features/support/env.rb +5 -2
  17. data/examples/v8/features/fibonacci.feature +1 -1
  18. data/examples/watir/features/step_definitions/search_steps.rb +1 -1
  19. data/features/announce.feature +164 -0
  20. data/features/around_hooks.feature +232 -0
  21. data/features/background.feature +95 -284
  22. data/features/bug_371.feature +32 -0
  23. data/features/bug_464.feature +16 -0
  24. data/features/bug_475.feature +42 -0
  25. data/features/bug_585_tab_indentation.feature +22 -0
  26. data/features/bug_600.feature +67 -0
  27. data/features/call_steps_from_stepdefs.feature +154 -0
  28. data/features/cucumber_cli.feature +591 -0
  29. data/features/cucumber_cli_outlines.feature +117 -0
  30. data/features/custom_formatter.feature +73 -3
  31. data/features/default_snippets.feature +42 -0
  32. data/features/diffing.feature +25 -0
  33. data/features/drb_server_integration.feature +174 -0
  34. data/features/exception_in_after_block.feature +127 -0
  35. data/features/exception_in_after_step_block.feature +104 -0
  36. data/features/exception_in_before_block.feature +98 -0
  37. data/features/exclude_files.feature +20 -0
  38. data/features/expand.feature +60 -0
  39. data/features/html_formatter.feature +8 -0
  40. data/features/html_formatter/a.html +582 -0
  41. data/features/json_formatter.feature +245 -160
  42. data/features/junit_formatter.feature +88 -0
  43. data/features/language_from_header.feature +30 -0
  44. data/features/language_help.feature +78 -0
  45. data/features/listener_debugger_formatter.feature +42 -0
  46. data/features/multiline_names.feature +44 -0
  47. data/features/negative_tagged_hooks.feature +60 -0
  48. data/features/post_configuration_hook.feature +37 -0
  49. data/features/profiles.feature +126 -0
  50. data/features/rake_task.feature +152 -0
  51. data/features/report_called_undefined_steps.feature +34 -0
  52. data/features/rerun_formatter.feature +45 -0
  53. data/features/simplest.feature +11 -0
  54. data/features/snippet.feature +23 -0
  55. data/features/snippets_when_using_star_keyword.feature +36 -0
  56. data/features/step_definitions/cucumber_steps.rb +153 -7
  57. data/features/step_definitions/extra_steps.rb +2 -0
  58. data/features/step_definitions/simplest_steps.rb +3 -0
  59. data/features/step_definitions/wire_steps.rb +32 -0
  60. data/features/support/env.rb +140 -18
  61. data/features/support/env.rb.simplest +7 -0
  62. data/features/support/fake_wire_server.rb +77 -0
  63. data/features/table_diffing.feature +45 -0
  64. data/features/table_mapping.feature +34 -0
  65. data/features/tag_logic.feature +258 -0
  66. data/features/transform.feature +245 -0
  67. data/features/unicode_table.feature +35 -0
  68. data/features/usage_and_stepdefs_formatter.feature +169 -0
  69. data/features/wire_protocol.feature +332 -0
  70. data/features/wire_protocol_table_diffing.feature +119 -0
  71. data/features/wire_protocol_tags.feature +87 -0
  72. data/features/wire_protocol_timeouts.feature +63 -0
  73. data/features/work_in_progress.feature +156 -0
  74. data/fixtures/json/features/pystring.feature +8 -0
  75. data/fixtures/junit/features/pending.feature +1 -3
  76. data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +12 -0
  77. data/fixtures/self_test/features/background/background_with_name.feature +7 -0
  78. data/fixtures/self_test/features/background/failing_background.feature +12 -0
  79. data/fixtures/self_test/features/background/failing_background_after_success.feature +11 -0
  80. data/fixtures/self_test/features/background/multiline_args_background.feature +32 -0
  81. data/fixtures/self_test/features/background/passing_background.feature +10 -0
  82. data/fixtures/self_test/features/background/pending_background.feature +10 -0
  83. data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +16 -0
  84. data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +16 -0
  85. data/fixtures/self_test/features/support/env.rb +0 -8
  86. data/fixtures/tickets/features.html +1 -1
  87. data/gem_tasks/examples.rake +1 -1
  88. data/gem_tasks/features.rake +14 -0
  89. data/gem_tasks/sdoc.rake +12 -0
  90. data/lib/cucumber.rb +0 -12
  91. data/lib/cucumber/ast.rb +1 -1
  92. data/lib/cucumber/ast/background.rb +5 -21
  93. data/lib/cucumber/ast/examples.rb +4 -12
  94. data/lib/cucumber/ast/feature.rb +5 -13
  95. data/lib/cucumber/ast/feature_element.rb +4 -9
  96. data/lib/cucumber/ast/outline_table.rb +4 -4
  97. data/lib/cucumber/ast/py_string.rb +80 -0
  98. data/lib/cucumber/ast/scenario.rb +5 -7
  99. data/lib/cucumber/ast/scenario_outline.rb +15 -23
  100. data/lib/cucumber/ast/step.rb +0 -5
  101. data/lib/cucumber/ast/step_invocation.rb +15 -21
  102. data/lib/cucumber/ast/table.rb +8 -14
  103. data/lib/cucumber/ast/tree_walker.rb +48 -10
  104. data/lib/cucumber/cli/configuration.rb +8 -33
  105. data/lib/cucumber/cli/main.rb +35 -20
  106. data/lib/cucumber/cli/options.rb +7 -8
  107. data/lib/cucumber/cli/profile_loader.rb +0 -2
  108. data/lib/cucumber/core_ext/proc.rb +1 -2
  109. data/lib/cucumber/feature_file.rb +15 -47
  110. data/lib/cucumber/formatter/ansicolor.rb +5 -3
  111. data/lib/cucumber/formatter/color_io.rb +23 -0
  112. data/lib/cucumber/formatter/console.rb +23 -27
  113. data/lib/cucumber/formatter/cucumber.css +17 -34
  114. data/lib/cucumber/formatter/cucumber.sass +182 -173
  115. data/lib/cucumber/formatter/html.rb +11 -46
  116. data/lib/cucumber/formatter/io.rb +4 -2
  117. data/lib/cucumber/formatter/json.rb +152 -15
  118. data/lib/cucumber/formatter/json_pretty.rb +6 -5
  119. data/lib/cucumber/formatter/junit.rb +22 -28
  120. data/lib/cucumber/formatter/pdf.rb +6 -6
  121. data/lib/cucumber/formatter/pretty.rb +5 -5
  122. data/lib/cucumber/formatter/rerun.rb +11 -22
  123. data/lib/cucumber/formatter/tag_cloud.rb +35 -0
  124. data/lib/cucumber/formatter/unicode.rb +20 -41
  125. data/lib/cucumber/js_support/js_dsl.js +4 -4
  126. data/lib/cucumber/js_support/js_language.rb +5 -9
  127. data/lib/cucumber/js_support/js_snippets.rb +2 -2
  128. data/lib/cucumber/language_support.rb +2 -2
  129. data/lib/cucumber/parser/gherkin_builder.rb +30 -35
  130. data/lib/cucumber/platform.rb +8 -8
  131. data/lib/cucumber/py_support/py_language.rb +2 -2
  132. data/lib/cucumber/rake/task.rb +31 -74
  133. data/lib/cucumber/rb_support/rb_dsl.rb +0 -1
  134. data/lib/cucumber/rb_support/rb_language.rb +8 -10
  135. data/lib/cucumber/rb_support/rb_step_definition.rb +0 -8
  136. data/lib/cucumber/rb_support/rb_transform.rb +0 -17
  137. data/lib/cucumber/rb_support/rb_world.rb +18 -26
  138. data/lib/cucumber/rspec/doubles.rb +3 -3
  139. data/lib/cucumber/step_match.rb +2 -6
  140. data/lib/cucumber/step_mother.rb +427 -6
  141. data/lib/cucumber/wire_support/configuration.rb +1 -4
  142. data/lib/cucumber/wire_support/wire_language.rb +10 -3
  143. data/spec/cucumber/ast/background_spec.rb +6 -68
  144. data/spec/cucumber/ast/feature_factory.rb +4 -5
  145. data/spec/cucumber/ast/feature_spec.rb +4 -4
  146. data/spec/cucumber/ast/outline_table_spec.rb +1 -1
  147. data/spec/cucumber/ast/py_string_spec.rb +40 -0
  148. data/spec/cucumber/ast/scenario_outline_spec.rb +11 -15
  149. data/spec/cucumber/ast/scenario_spec.rb +4 -4
  150. data/spec/cucumber/ast/step_spec.rb +3 -3
  151. data/spec/cucumber/ast/table_spec.rb +2 -38
  152. data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
  153. data/spec/cucumber/broadcaster_spec.rb +1 -1
  154. data/spec/cucumber/cli/configuration_spec.rb +6 -32
  155. data/spec/cucumber/cli/drb_client_spec.rb +3 -2
  156. data/spec/cucumber/cli/main_spec.rb +43 -43
  157. data/spec/cucumber/cli/options_spec.rb +1 -28
  158. data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
  159. data/spec/cucumber/core_ext/proc_spec.rb +1 -1
  160. data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
  161. data/spec/cucumber/formatter/color_io_spec.rb +29 -0
  162. data/spec/cucumber/formatter/duration_spec.rb +1 -1
  163. data/spec/cucumber/formatter/html_spec.rb +5 -3
  164. data/spec/cucumber/formatter/junit_spec.rb +2 -16
  165. data/spec/cucumber/formatter/progress_spec.rb +1 -1
  166. data/spec/cucumber/formatter/spec_helper.rb +12 -11
  167. data/spec/cucumber/rb_support/rb_language_spec.rb +28 -241
  168. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +28 -33
  169. data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
  170. data/spec/cucumber/step_match_spec.rb +9 -11
  171. data/spec/cucumber/step_mother_spec.rb +302 -0
  172. data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
  173. data/spec/cucumber/wire_support/connection_spec.rb +1 -1
  174. data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
  175. data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
  176. data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
  177. data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
  178. data/spec/cucumber/world/pending_spec.rb +2 -2
  179. data/spec/spec_helper.rb +20 -13
  180. metadata +78 -4
@@ -0,0 +1,232 @@
1
+ Feature: Around hooks
2
+ In order to support transactional scenarios for database libraries
3
+ that provide only a block syntax for transactions, Cucumber should
4
+ permit definition of Around hooks.
5
+
6
+ Scenario: A single Around hook
7
+ Given a standard Cucumber project directory structure
8
+ And a file named "features/step_definitions/steps.rb" with:
9
+ """
10
+ Then /^the hook is called$/ do
11
+ $hook_called.should == true
12
+ end
13
+ """
14
+ And a file named "features/support/hooks.rb" with:
15
+ """
16
+ Around do |scenario, block|
17
+ $hook_called = true
18
+ block.call
19
+ end
20
+ """
21
+ And a file named "features/f.feature" with:
22
+ """
23
+ Feature: Around hooks
24
+ Scenario: using hook
25
+ Then the hook is called
26
+ """
27
+ When I run cucumber features/f.feature
28
+ Then it should pass with
29
+ """
30
+ Feature: Around hooks
31
+
32
+ Scenario: using hook # features/f.feature:2
33
+ Then the hook is called # features/step_definitions/steps.rb:1
34
+
35
+ 1 scenario (1 passed)
36
+ 1 step (1 passed)
37
+
38
+ """
39
+
40
+ Scenario: Multiple Around hooks
41
+ Given a standard Cucumber project directory structure
42
+ And a file named "features/step_definitions/steps.rb" with:
43
+ """
44
+ Then /^the hooks are called in the correct order$/ do
45
+ $hooks_called.should == ['A', 'B', 'C']
46
+ end
47
+ """
48
+ And a file named "features/support/hooks.rb" with:
49
+ """
50
+ Around do |scenario, block|
51
+ $hooks_called ||= []
52
+ $hooks_called << 'A'
53
+ block.call
54
+ end
55
+
56
+ Around do |scenario, block|
57
+ $hooks_called ||= []
58
+ $hooks_called << 'B'
59
+ block.call
60
+ end
61
+
62
+ Around do |scenario, block|
63
+ $hooks_called ||= []
64
+ $hooks_called << 'C'
65
+ block.call
66
+ end
67
+ """
68
+ And a file named "features/f.feature" with:
69
+ """
70
+ Feature: Around hooks
71
+ Scenario: using multiple hooks
72
+ Then the hooks are called in the correct order
73
+ """
74
+ When I run cucumber features/f.feature
75
+ Then it should pass with
76
+ """
77
+ Feature: Around hooks
78
+
79
+ Scenario: using multiple hooks # features/f.feature:2
80
+ Then the hooks are called in the correct order # features/step_definitions/steps.rb:1
81
+
82
+ 1 scenario (1 passed)
83
+ 1 step (1 passed)
84
+
85
+ """
86
+
87
+ Scenario: Mixing Around, Before, and After hooks
88
+ Given a standard Cucumber project directory structure
89
+ And a file named "features/step_definitions/steps.rb" with:
90
+ """
91
+ Then /^the Around hook is called around Before and After hooks$/ do
92
+ $hooks_called.should == ['Around', 'Before']
93
+ end
94
+ """
95
+ And a file named "features/support/hooks.rb" with:
96
+ """
97
+ Around do |scenario, block|
98
+ $hooks_called ||= []
99
+ $hooks_called << 'Around'
100
+ block.call
101
+ $hooks_called << 'Around'
102
+ $hooks_called.should == ['Around', 'Before', 'After', 'Around']
103
+ end
104
+
105
+ Before do |scenario|
106
+ $hooks_called ||= []
107
+ $hooks_called << 'Before'
108
+ end
109
+
110
+ After do |scenario|
111
+ $hooks_called ||= []
112
+ $hooks_called << 'After'
113
+ $hooks_called.should == ['Around', 'Before', 'After']
114
+ end
115
+ """
116
+ And a file named "features/f.feature" with:
117
+ """
118
+ Feature: Around hooks
119
+ Scenario: Mixing Around, Before, and After hooks
120
+ Then the Around hook is called around Before and After hooks
121
+ """
122
+ When I run cucumber features/f.feature
123
+ Then it should pass with
124
+ """
125
+ Feature: Around hooks
126
+
127
+ Scenario: Mixing Around, Before, and After hooks # features/f.feature:2
128
+ Then the Around hook is called around Before and After hooks # features/step_definitions/steps.rb:1
129
+
130
+ 1 scenario (1 passed)
131
+ 1 step (1 passed)
132
+
133
+ """
134
+
135
+ Scenario: Around hooks with tags
136
+ Given a standard Cucumber project directory structure
137
+ And a file named "features/step_definitions/steps.rb" with:
138
+ """
139
+ Then /^the Around hooks with matching tags are called$/ do
140
+ $hooks_called.should == ['one', 'one or two']
141
+ end
142
+ """
143
+ And a file named "features/support/hooks.rb" with:
144
+ """
145
+ Around('@one') do |scenario, block|
146
+ $hooks_called ||= []
147
+ $hooks_called << 'one'
148
+ block.call
149
+ end
150
+
151
+ Around('@one,@two') do |scenario, block|
152
+ $hooks_called ||= []
153
+ $hooks_called << 'one or two'
154
+ block.call
155
+ end
156
+
157
+ Around('@one', '@two') do |scenario, block|
158
+ $hooks_called ||= []
159
+ $hooks_called << 'one and two'
160
+ block.call
161
+ end
162
+
163
+ Around('@two') do |scenario, block|
164
+ $hooks_called ||= []
165
+ $hooks_called << 'two'
166
+ block.call
167
+ end
168
+ """
169
+ And a file named "features/f.feature" with:
170
+ """
171
+ Feature: Around hooks
172
+ @one
173
+ Scenario: Around hooks with tags
174
+ Then the Around hooks with matching tags are called
175
+ """
176
+ When I run cucumber -q -t @one features/f.feature
177
+ Then it should pass with
178
+ """
179
+ Feature: Around hooks
180
+
181
+ @one
182
+ Scenario: Around hooks with tags
183
+ Then the Around hooks with matching tags are called
184
+
185
+ 1 scenario (1 passed)
186
+ 1 step (1 passed)
187
+
188
+ """
189
+
190
+ Scenario: Around hooks with scenario outlines
191
+ Given a standard Cucumber project directory structure
192
+ And a file named "features/step_definitions/steps.rb" with:
193
+ """
194
+ Then /^the hook is called$/ do
195
+ $hook_called.should == true
196
+ end
197
+ """
198
+ And a file named "features/support/hooks.rb" with:
199
+ """
200
+ Around do |scenario, block|
201
+ $hook_called = true
202
+ block.call
203
+ end
204
+ """
205
+ And a file named "features/f.feature" with:
206
+ """
207
+ Feature: Around hooks with scenario outlines
208
+ Scenario Outline: using hook
209
+ Then the hook is called
210
+
211
+ Examples:
212
+ | Number |
213
+ | one |
214
+ | two |
215
+ """
216
+ When I run cucumber features/f.feature
217
+ Then it should pass with
218
+ """
219
+ Feature: Around hooks with scenario outlines
220
+
221
+ Scenario Outline: using hook # features/f.feature:2
222
+ Then the hook is called # features/step_definitions/steps.rb:1
223
+
224
+ Examples:
225
+ | Number |
226
+ | one |
227
+ | two |
228
+
229
+ 2 scenarios (2 passed)
230
+ 2 steps (2 passed)
231
+
232
+ """
@@ -1,195 +1,12 @@
1
- Feature: Background
1
+ Feature: backgrounds
2
2
  In order to provide a context to my scenarios within a feature
3
3
  As a feature editor
4
4
  I want to write a background section in my features.
5
5
 
6
- Background:
7
- Given a file named "features/passing_background.feature" with:
8
- """
9
- Feature: Passing background sample
10
-
11
- Background:
12
- Given '10' cukes
13
-
14
- Scenario: passing background
15
- Then I should have '10' cukes
16
-
17
- Scenario: another passing background
18
- Then I should have '10' cukes
19
- """
20
- And a file named "features/scenario_outline_passing_background.feature" with:
21
- """
22
- Feature: Passing background with scenario outlines sample
23
-
24
- Background:
25
- Given '10' cukes
26
-
27
- Scenario Outline: passing background
28
- Then I should have '<count>' cukes
29
- Examples:
30
- |count|
31
- | 10 |
32
-
33
- Scenario Outline: another passing background
34
- Then I should have '<count>' cukes
35
- Examples:
36
- |count|
37
- | 10 |
38
- """
39
- And a file named "features/background_tagged_before_on_outline.feature" with:
40
- """
41
- @background_tagged_before_on_outline
42
- Feature: Background tagged Before on Outline
43
-
44
- Background:
45
- Given passing without a table
46
-
47
- Scenario Outline: passing background
48
- Then I should have '<count>' cukes
49
-
50
- Examples:
51
- | count |
52
- | 888 |
53
- """
54
- And a file named "features/failing_background.feature" with:
55
- """
56
- Feature: Failing background sample
57
-
58
- Background:
59
- Given failing without a table
60
- And '10' cukes
61
-
62
- Scenario: failing background
63
- Then I should have '10' cukes
64
-
65
- Scenario: another failing background
66
- Then I should have '10' cukes
67
- """
68
- And a file named "features/scenario_outline_failing_background.feature" with:
69
- """
70
- Feature: Failing background with scenario outlines sample
71
-
72
- Background:
73
- Given failing without a table
74
-
75
- Scenario Outline: failing background
76
- Then I should have '<count>' cukes
77
- Examples:
78
- |count|
79
- | 10 |
80
-
81
- Scenario Outline: another failing background
82
- Then I should have '<count>' cukes
83
- Examples:
84
- |count|
85
- | 10 |
86
- """
87
- And a file named "features/pending_background.feature" with:
88
- """
89
- Feature: Pending background sample
90
-
91
- Background:
92
- Given pending
93
-
94
- Scenario: pending background
95
- Then I should have '10' cukes
96
-
97
- Scenario: another pending background
98
- Then I should have '10' cukes
99
- """
100
- And a file named "features/failing_background_after_success.feature" with:
101
- """
102
- Feature: Failing background after previously successful background sample
103
-
104
- Background:
105
- Given passing without a table
106
- And '10' global cukes
107
-
108
- Scenario: passing background
109
- Then I should have '10' global cukes
110
-
111
- Scenario: failing background
112
- Then I should have '10' global cukes
113
- """
114
- And a file named "features/multiline_args_background.feature" with:
115
- """
116
- Feature: Passing background with multiline args
117
-
118
- Background:
119
- Given table
120
- |a|b|
121
- |c|d|
122
- And multiline string
123
- \"\"\"
124
- I'm a cucumber and I'm okay.
125
- I sleep all night and I test all day
126
- \"\"\"
127
-
128
- Scenario: passing background
129
- Then the table should be
130
- |a|b|
131
- |c|d|
132
- Then the multiline string should be
133
- \"\"\"
134
- I'm a cucumber and I'm okay.
135
- I sleep all night and I test all day
136
- \"\"\"
137
-
138
- Scenario: another passing background
139
- Then the table should be
140
- |a|b|
141
- |c|d|
142
- Then the multiline string should be
143
- \"\"\"
144
- I'm a cucumber and I'm okay.
145
- I sleep all night and I test all day
146
- \"\"\"
147
- """
148
- And a file named "features/step_definitions/steps.rb" with:
149
- """
150
- def flunker
151
- raise "FAIL"
152
- end
153
-
154
- Given /^'(.+)' cukes$/ do |cukes| x=1
155
- raise "We already have #{@cukes} cukes!" if @cukes
156
- @cukes = cukes
157
- end
158
-
159
- Given(/^passing without a table$/) do
160
- end
161
-
162
- Given /^failing without a table$/ do x=1
163
- flunker
164
- end
165
-
166
- Given /^'(.+)' global cukes$/ do |cukes| x=1
167
- $scenario_runs ||= 0
168
- flunker if $scenario_runs >= 1
169
- $cukes = cukes
170
- $scenario_runs += 1
171
- end
172
-
173
- Then /^I should have '(.+)' global cukes$/ do |cukes| x=1
174
- $cukes.should == cukes
175
- end
176
-
177
- Then /^I should have '(.+)' cukes$/ do |cukes| x=1
178
- @cukes.should == cukes
179
- end
180
-
181
- Before('@background_tagged_before_on_outline') do
182
- @cukes = '888'
183
- end
184
-
185
- After('@background_tagged_before_on_outline') do
186
- @cukes.should == '888'
187
- end
188
- """
189
-
190
6
  Scenario: run a specific scenario with a background
191
- When I run `cucumber -q features/passing_background.feature:9`
192
- Then it should pass with exactly:
7
+ When I run cucumber -q features/background/passing_background.feature:9 --require features
8
+ Then STDERR should be empty
9
+ Then it should pass with
193
10
  """
194
11
  Feature: Passing background sample
195
12
 
@@ -201,13 +18,12 @@ Feature: Background
201
18
 
202
19
  1 scenario (1 passed)
203
20
  2 steps (2 passed)
204
- 0m0.012s
205
-
21
+
206
22
  """
207
23
 
208
24
  Scenario: run a feature with a background that passes
209
- When I run `cucumber -q features/passing_background.feature`
210
- Then it should pass with exactly:
25
+ When I run cucumber -q features/background/passing_background.feature --require features
26
+ Then it should pass with
211
27
  """
212
28
  Feature: Passing background sample
213
29
 
@@ -222,13 +38,12 @@ Feature: Background
222
38
 
223
39
  2 scenarios (2 passed)
224
40
  4 steps (4 passed)
225
- 0m0.012s
226
-
41
+
227
42
  """
228
43
 
229
44
  Scenario: run a feature with scenario outlines that has a background that passes
230
- When I run `cucumber -q features/scenario_outline_passing_background.feature`
231
- Then it should pass with exactly:
45
+ When I run cucumber -q features/background/scenario_outline_passing_background.feature --require features
46
+ Then it should pass with
232
47
  """
233
48
  Feature: Passing background with scenario outlines sample
234
49
 
@@ -251,13 +66,12 @@ Feature: Background
251
66
 
252
67
  2 scenarios (2 passed)
253
68
  4 steps (4 passed)
254
- 0m0.012s
255
69
 
256
70
  """
257
71
 
258
72
  Scenario: run a feature with scenario outlines that has a background that passes
259
- When I run `cucumber -q features/background_tagged_before_on_outline.feature`
260
- Then it should pass with exactly:
73
+ When I run cucumber -q features/background/background_tagged_before_on_outline.feature --require features
74
+ Then it should pass with
261
75
  """
262
76
  @background_tagged_before_on_outline
263
77
  Feature: Background tagged Before on Outline
@@ -274,22 +88,22 @@ Feature: Background
274
88
 
275
89
  1 scenario (1 passed)
276
90
  2 steps (2 passed)
277
- 0m0.012s
278
91
 
279
92
  """
280
93
 
281
94
  Scenario: run a feature with a background that fails
282
- When I run `cucumber -q features/failing_background.feature`
283
- Then it should fail with exactly:
95
+ When I run cucumber -q features/background/failing_background.feature --require features
96
+ Then it should fail with
284
97
  """
98
+ @after_file
285
99
  Feature: Failing background sample
286
100
 
287
101
  Background:
288
102
  Given failing without a table
289
103
  FAIL (RuntimeError)
290
- ./features/step_definitions/steps.rb:2:in `flunker'
291
- ./features/step_definitions/steps.rb:14:in `/^failing without a table$/'
292
- features/failing_background.feature:4:in `Given failing without a table'
104
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
105
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
106
+ features/background/failing_background.feature:5:in `Given failing without a table'
293
107
  And '10' cukes
294
108
 
295
109
  Scenario: failing background
@@ -299,26 +113,26 @@ Feature: Background
299
113
  Then I should have '10' cukes
300
114
 
301
115
  Failing Scenarios:
302
- cucumber features/failing_background.feature:7 # Scenario: failing background
116
+ cucumber features/background/failing_background.feature:8 # Scenario: failing background
303
117
 
304
118
  2 scenarios (1 failed, 1 skipped)
305
119
  6 steps (1 failed, 5 skipped)
306
- 0m0.012s
307
-
120
+
308
121
  """
122
+ And "fixtures/self_test/tmp/after.txt" should exist
309
123
 
310
124
  Scenario: run a feature with scenario outlines that has a background that fails
311
- When I run `cucumber -q features/scenario_outline_failing_background.feature`
312
- Then it should fail with exactly:
125
+ When I run cucumber -q features/background/scenario_outline_failing_background.feature --require features
126
+ Then it should fail with
313
127
  """
314
128
  Feature: Failing background with scenario outlines sample
315
129
 
316
130
  Background:
317
131
  Given failing without a table
318
132
  FAIL (RuntimeError)
319
- ./features/step_definitions/steps.rb:2:in `flunker'
320
- ./features/step_definitions/steps.rb:14:in `/^failing without a table$/'
321
- features/scenario_outline_failing_background.feature:4:in `Given failing without a table'
133
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
134
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
135
+ features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'
322
136
 
323
137
  Scenario Outline: failing background
324
138
  Then I should have '<count>' cukes
@@ -335,17 +149,16 @@ Feature: Background
335
149
  | 10 |
336
150
 
337
151
  Failing Scenarios:
338
- cucumber features/scenario_outline_failing_background.feature:6 # Scenario: failing background
152
+ cucumber features/background/scenario_outline_failing_background.feature:6 # Scenario: failing background
339
153
 
340
154
  2 scenarios (1 failed, 1 skipped)
341
155
  4 steps (1 failed, 3 skipped)
342
- 0m0.012s
343
-
156
+
344
157
  """
345
158
 
346
159
  Scenario: run a feature with a background that is pending
347
- When I run `cucumber -q features/pending_background.feature`
348
- Then it should pass with exactly:
160
+ When I run cucumber -q features/background/pending_background.feature --require features
161
+ Then it should pass with
349
162
  """
350
163
  Feature: Pending background sample
351
164
 
@@ -360,13 +173,12 @@ Feature: Background
360
173
 
361
174
  2 scenarios (2 undefined)
362
175
  4 steps (2 skipped, 2 undefined)
363
- 0m0.012s
364
-
176
+
365
177
  """
366
178
 
367
179
  Scenario: background passes with first scenario but fails with second
368
- When I run `cucumber -q features/failing_background_after_success.feature`
369
- Then it should fail with exactly:
180
+ When I run cucumber -q features/background/failing_background_after_success.feature --require features
181
+ Then it should fail with
370
182
  """
371
183
  Feature: Failing background after previously successful background sample
372
184
 
@@ -380,86 +192,84 @@ Feature: Background
380
192
  Scenario: failing background
381
193
  And '10' global cukes
382
194
  FAIL (RuntimeError)
383
- ./features/step_definitions/steps.rb:2:in `flunker'
384
- ./features/step_definitions/steps.rb:19:in `/^'(.+)' global cukes$/'
385
- features/failing_background_after_success.feature:5:in `And '10' global cukes'
195
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
196
+ ./features/step_definitions/sample_steps.rb:37:in `/^'(.+)' global cukes$/'
197
+ features/background/failing_background_after_success.feature:5:in `And '10' global cukes'
386
198
  Then I should have '10' global cukes
387
199
 
388
200
  Failing Scenarios:
389
- cucumber features/failing_background_after_success.feature:10 # Scenario: failing background
201
+ cucumber features/background/failing_background_after_success.feature:10 # Scenario: failing background
390
202
 
391
203
  2 scenarios (1 failed, 1 passed)
392
204
  6 steps (1 failed, 1 skipped, 4 passed)
393
- 0m0.012s
394
-
205
+
395
206
  """
396
207
 
397
208
  Scenario: background with multline args
398
- Given a file named "features/step_definitions/multiline_steps.rb" with:
399
- """
400
- Given /^table$/ do |table| x=1
401
- @table = table
402
- end
403
-
404
- Given /^multiline string$/ do |string| x=1
405
- @multiline = string
406
- end
407
-
408
- Then /^the table should be$/ do |table| x=1
409
- @table.raw.should == table.raw
410
- end
209
+ When I run cucumber -q features/background/multiline_args_background.feature --require features
210
+ Then it should pass with
211
+ """
212
+ Feature: Passing background with multiline args
411
213
 
412
- Then /^the multiline string should be$/ do |string| x=1
413
- @multiline.should == string
414
- end
415
- """
416
- When I run `cucumber -q features/multiline_args_background.feature`
417
- Then it should pass with exactly:
418
- """
419
- Feature: Passing background with multiline args
420
-
421
- Background:
422
- Given table
423
- | a | b |
424
- | c | d |
425
- And multiline string
426
- \"\"\"
214
+ Background:
215
+ Given table
216
+ | a | b |
217
+ | c | d |
218
+ And multiline string
219
+ \"\"\"
427
220
  I'm a cucumber and I'm okay.
428
221
  I sleep all night and I test all day
429
- \"\"\"
430
-
431
- Scenario: passing background
432
- Then the table should be
433
- | a | b |
434
- | c | d |
435
- Then the multiline string should be
436
- \"\"\"
222
+ \"\"\"
223
+
224
+ Scenario: passing background
225
+ Then the table should be
226
+ | a | b |
227
+ | c | d |
228
+ Then the multiline string should be
229
+ \"\"\"
437
230
  I'm a cucumber and I'm okay.
438
231
  I sleep all night and I test all day
439
- \"\"\"
440
-
441
- Scenario: another passing background
442
- Then the table should be
443
- | a | b |
444
- | c | d |
445
- Then the multiline string should be
446
- \"\"\"
232
+ \"\"\"
233
+
234
+ Scenario: another passing background
235
+ Then the table should be
236
+ | a | b |
237
+ | c | d |
238
+ Then the multiline string should be
239
+ \"\"\"
447
240
  I'm a cucumber and I'm okay.
448
241
  I sleep all night and I test all day
449
- \"\"\"
242
+ \"\"\"
450
243
 
451
- 2 scenarios (2 passed)
452
- 8 steps (8 passed)
453
- 0m0.012s
244
+ 2 scenarios (2 passed)
245
+ 8 steps (8 passed)
454
246
 
455
- """
247
+ """
248
+
249
+ Scenario: background with name
250
+ When I run cucumber -q features/background/background_with_name.feature --require features
251
+ Then it should pass with
252
+ """
253
+ Feature: background with name
254
+
255
+ Background: I'm a background and I'm ok
256
+ Given '10' cukes
257
+
258
+ Scenario: example
259
+ Then I should have '10' cukes
260
+
261
+ 1 scenario (1 passed)
262
+ 2 steps (2 passed)
263
+
264
+ """
456
265
 
457
266
  Scenario: https://rspec.lighthouseapp.com/projects/16211/tickets/329
458
- Given a file named "features/only_background_and_hooks.feature" with:
267
+ Given a standard Cucumber project directory structure
268
+ And a file named "features/only_background_and_hooks.feature" with:
459
269
  """
460
270
  Feature: woo yeah
461
271
 
462
- Background: Whatever
272
+ Background:
463
273
  Given whatever
464
274
 
465
275
  """
@@ -483,16 +293,17 @@ Feature: Background
483
293
  $after.should == true
484
294
  end
485
295
  """
486
- When I run `cucumber features/only_background_and_hooks.feature`
487
- Then it should pass with exactly:
296
+ When I run cucumber features/only_background_and_hooks.feature
297
+ Then it should pass
298
+ And the output should be
488
299
  """
489
300
  Feature: woo yeah
490
301
 
491
- Background: Whatever # features/only_background_and_hooks.feature:3
492
- Given whatever # features/only_background_and_hooks_steps.rb:11
302
+ Background: # features/only_background_and_hooks.feature:3
303
+ Given whatever # features/only_background_and_hooks_steps.rb:11
493
304
 
494
305
  0 scenarios
495
306
  1 step (1 passed)
496
- 0m0.012s
497
-
307
+
498
308
  """
309
+ And STDERR should be empty