cucumber 2.0.0.beta.3 → 2.0.0

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 (147) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/History.md +131 -32
  4. data/Rakefile +0 -2
  5. data/cucumber.gemspec +4 -3
  6. data/examples/i18n/ht/Rakefile +6 -0
  7. data/examples/i18n/ht/features/adisyon.feature +17 -0
  8. data/examples/i18n/ht/features/divizyon.feature +10 -0
  9. data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +25 -0
  10. data/examples/i18n/ht/lib/kalkilatris.rb +14 -0
  11. data/examples/tcl/features/step_definitions/fib_steps.rb +1 -1
  12. data/features/docs/cli/dry_run.feature +48 -0
  13. data/features/docs/cli/exclude_files.feature +1 -2
  14. data/features/docs/cli/run_specific_scenarios.feature +28 -66
  15. data/features/docs/cli/strict_mode.feature +24 -1
  16. data/features/docs/defining_steps/nested_steps.feature +49 -0
  17. data/features/docs/defining_steps/skip_scenario.feature +31 -2
  18. data/features/docs/defining_steps/snippets.feature +15 -0
  19. data/features/docs/exception_in_after_step_hook.feature +1 -1
  20. data/features/docs/exception_in_around_hook.feature +80 -0
  21. data/features/docs/extending_cucumber/custom_filter.feature +29 -0
  22. data/features/docs/extending_cucumber/custom_formatter.feature +65 -7
  23. data/features/docs/formatters/debug_formatter.feature +24 -17
  24. data/features/docs/formatters/json_formatter.feature +65 -1
  25. data/features/docs/formatters/junit_formatter.feature +40 -0
  26. data/features/docs/formatters/pretty_formatter.feature +42 -0
  27. data/features/docs/formatters/rerun_formatter.feature +3 -2
  28. data/features/docs/getting_started.feature +1 -1
  29. data/features/docs/{wire_protocol_erb.feature → wire_protocol/erb_configuration.feature} +2 -2
  30. data/features/docs/wire_protocol/handle_unexpected_response.feature +30 -0
  31. data/features/docs/wire_protocol/invoke_message.feature +216 -0
  32. data/features/docs/wire_protocol/readme.md +26 -0
  33. data/features/docs/wire_protocol/snippets_message.feature +51 -0
  34. data/features/docs/wire_protocol/step_matches_message.feature +81 -0
  35. data/features/docs/{wire_protocol_table_diffing.feature → wire_protocol/table_diffing.feature} +1 -0
  36. data/features/docs/{wire_protocol_tags.feature → wire_protocol/tags.feature} +1 -0
  37. data/features/docs/{wire_protocol_timeouts.feature → wire_protocol/timeouts.feature} +1 -0
  38. data/features/docs/work_in_progress.feature +1 -1
  39. data/features/docs/writing_support_code/after_hooks.feature +24 -0
  40. data/features/docs/writing_support_code/around_hooks.feature +31 -0
  41. data/features/docs/writing_support_code/before_hook.feature +7 -3
  42. data/features/docs/writing_support_code/tagged_hooks.feature +44 -6
  43. data/features/lib/step_definitions/wire_steps.rb +18 -1
  44. data/features/lib/support/fake_wire_server.rb +10 -7
  45. data/lib/cucumber/cli/configuration.rb +6 -11
  46. data/lib/cucumber/cli/main.rb +2 -2
  47. data/lib/cucumber/cli/options.rb +8 -1
  48. data/lib/cucumber/cli/profile_loader.rb +1 -1
  49. data/lib/cucumber/core_ext/instance_exec.rb +1 -1
  50. data/lib/cucumber/encoding.rb +5 -0
  51. data/lib/cucumber/errors.rb +8 -0
  52. data/lib/cucumber/file_specs.rb +3 -1
  53. data/lib/cucumber/filters/activate_steps.rb +33 -0
  54. data/lib/cucumber/filters/apply_after_hooks.rb +9 -0
  55. data/lib/cucumber/filters/apply_after_step_hooks.rb +12 -0
  56. data/lib/cucumber/filters/apply_around_hooks.rb +12 -0
  57. data/lib/cucumber/filters/apply_before_hooks.rb +9 -0
  58. data/lib/cucumber/{runtime → filters}/gated_receiver.rb +5 -1
  59. data/lib/cucumber/filters/prepare_world.rb +45 -0
  60. data/lib/cucumber/filters/quit.rb +28 -0
  61. data/lib/cucumber/filters/randomizer.rb +40 -0
  62. data/lib/cucumber/{runtime → filters}/tag_limits/test_case_index.rb +4 -2
  63. data/lib/cucumber/{runtime → filters}/tag_limits/verifier.rb +4 -2
  64. data/lib/cucumber/filters/tag_limits.rb +45 -0
  65. data/lib/cucumber/filters.rb +9 -0
  66. data/lib/cucumber/formatter/ansicolor.rb +0 -8
  67. data/lib/cucumber/formatter/console.rb +37 -20
  68. data/lib/cucumber/formatter/debug.rb +1 -8
  69. data/lib/cucumber/formatter/fanout.rb +27 -0
  70. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +10 -9
  71. data/lib/cucumber/formatter/html.rb +31 -6
  72. data/lib/cucumber/formatter/ignore_missing_messages.rb +20 -0
  73. data/lib/cucumber/formatter/junit.rb +97 -2
  74. data/lib/cucumber/formatter/legacy_api/adapter.rb +1060 -0
  75. data/lib/cucumber/formatter/legacy_api/ast.rb +376 -0
  76. data/lib/cucumber/formatter/legacy_api/results.rb +51 -0
  77. data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +30 -0
  78. data/lib/cucumber/formatter/pretty.rb +14 -0
  79. data/lib/cucumber/formatter/progress.rb +10 -0
  80. data/lib/cucumber/formatter/rerun.rb +14 -88
  81. data/lib/cucumber/hooks.rb +97 -0
  82. data/lib/cucumber/language_support/language_methods.rb +0 -54
  83. data/lib/cucumber/multiline_argument/data_table.rb +41 -29
  84. data/lib/cucumber/platform.rb +3 -3
  85. data/lib/cucumber/project_initializer.rb +43 -0
  86. data/lib/cucumber/rb_support/rb_hook.rb +2 -2
  87. data/lib/cucumber/rb_support/rb_step_definition.rb +11 -2
  88. data/lib/cucumber/rb_support/rb_transform.rb +3 -1
  89. data/lib/cucumber/rb_support/rb_world.rb +2 -2
  90. data/lib/cucumber/rb_support/snippet.rb +1 -1
  91. data/lib/cucumber/rspec/doubles.rb +1 -1
  92. data/lib/cucumber/running_test_case.rb +115 -0
  93. data/lib/cucumber/runtime/after_hooks.rb +24 -0
  94. data/lib/cucumber/runtime/before_hooks.rb +23 -0
  95. data/lib/cucumber/runtime/for_programming_languages.rb +4 -8
  96. data/lib/cucumber/runtime/step_hooks.rb +22 -0
  97. data/lib/cucumber/runtime/support_code.rb +70 -5
  98. data/lib/cucumber/runtime.rb +56 -112
  99. data/lib/cucumber/step_match.rb +26 -2
  100. data/lib/cucumber.rb +7 -3
  101. data/spec/cucumber/cli/configuration_spec.rb +16 -1
  102. data/spec/cucumber/cli/profile_loader_spec.rb +10 -0
  103. data/spec/cucumber/core_ext/instance_exec_spec.rb +4 -0
  104. data/spec/cucumber/file_specs_spec.rb +21 -2
  105. data/spec/cucumber/filters/activate_steps_spec.rb +57 -0
  106. data/spec/cucumber/{runtime → filters}/gated_receiver_spec.rb +3 -3
  107. data/spec/cucumber/{runtime → filters}/tag_limits/test_case_index_spec.rb +3 -3
  108. data/spec/cucumber/{runtime → filters}/tag_limits/verifier_spec.rb +4 -4
  109. data/spec/cucumber/{runtime/tag_limits/filter_spec.rb → filters/tag_limits_spec.rb} +6 -6
  110. data/spec/cucumber/formatter/debug_spec.rb +25 -530
  111. data/spec/cucumber/formatter/html_spec.rb +140 -0
  112. data/spec/cucumber/formatter/junit_spec.rb +212 -156
  113. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +2090 -0
  114. data/spec/cucumber/formatter/pretty_spec.rb +248 -2
  115. data/spec/cucumber/formatter/rerun_spec.rb +107 -0
  116. data/spec/cucumber/formatter/spec_helper.rb +17 -8
  117. data/spec/cucumber/hooks_spec.rb +30 -0
  118. data/spec/cucumber/multiline_argument/data_table_spec.rb +53 -47
  119. data/spec/cucumber/project_initializer_spec.rb +87 -0
  120. data/spec/cucumber/rb_support/rb_language_spec.rb +2 -2
  121. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +32 -7
  122. data/spec/cucumber/rb_support/rb_transform_spec.rb +20 -0
  123. data/spec/cucumber/rb_support/snippet_spec.rb +6 -6
  124. data/spec/cucumber/running_test_case_spec.rb +83 -0
  125. data/spec/cucumber/runtime_spec.rb +1 -5
  126. data/spec/spec_helper.rb +3 -4
  127. metadata +149 -107
  128. data/bin/cuke +0 -60
  129. data/features/docs/extending_cucumber/formatter_callbacks.feature +0 -370
  130. data/features/docs/output_from_hooks.feature +0 -128
  131. data/features/docs/report_called_undefined_steps.feature +0 -57
  132. data/features/docs/wire_protocol.feature +0 -337
  133. data/gem_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
  134. data/gem_tasks/yard/default/layout/html/footer.erb +0 -5
  135. data/gem_tasks/yard/default/layout/html/index.erb +0 -1
  136. data/gem_tasks/yard/default/layout/html/layout.erb +0 -25
  137. data/gem_tasks/yard/default/layout/html/logo.erb +0 -1
  138. data/gem_tasks/yard/default/layout/html/setup.rb +0 -4
  139. data/gem_tasks/yard.rake +0 -43
  140. data/lib/cucumber/mappings.rb +0 -238
  141. data/lib/cucumber/reports/legacy_formatter.rb +0 -1349
  142. data/lib/cucumber/runtime/results.rb +0 -64
  143. data/lib/cucumber/runtime/tag_limits/filter.rb +0 -31
  144. data/lib/cucumber/runtime/tag_limits.rb +0 -15
  145. data/spec/cucumber/mappings_spec.rb +0 -180
  146. data/spec/cucumber/reports/legacy_formatter_spec.rb +0 -1860
  147. data/spec/cucumber/runtime/results_spec.rb +0 -88
@@ -1,337 +0,0 @@
1
- @wire
2
- Feature: Wire Protocol
3
- In order to be allow Cucumber to touch my app in intimate places
4
- As a developer on platform which doesn't support Ruby
5
- I want a low-level protocol which Cucumber can use to run steps within my app
6
-
7
- #
8
- # Cucumber's wire protocol is an implementation of Cucumber's internal
9
- # 'programming language' abstraction, and allows step definitions to be
10
- # implemented and invoked on any platform.
11
- #
12
- # Communication is over a TCP socket, which Cucumber connects to when it finds
13
- # a definition file with the .wire extension in the step_definitions folder
14
- # (or other load path). Note that these files are rendered with ERB when loaded.
15
- #
16
- # Cucumber sends the following request messages out over the wire:
17
- #
18
- # * step_matches : this is used to find out whether the wire server has a
19
- # definition for a given step
20
- # * invoke : this is used to ask for a step definition to be invoked
21
- # * begin_scenario : signals that cucumber is about to execute a scenario
22
- # * end_scenario : signals that cucumber has finished executing a scenario
23
- # * snippet_text : requests a snippet for an undefined step
24
- #
25
- # Every message supports two standard responses:
26
- # * success : which expects different arguments (sometimes none at
27
- # all) depending on the request.
28
- # * fail : causes a Cucumber::WireSupport::WireException to be
29
- # raised.
30
- #
31
- # Some messages support more responses - see below for details.
32
- #
33
- # A WirePacket flowing in either direction is formatted as a JSON-encoded
34
- # string, with a newline character signaling the end of a packet. See the
35
- # specs for Cucumber::WireSupport::WirePacket for more details.
36
- #
37
- # These messages are described in detail below, with examples.
38
- #
39
-
40
- Background:
41
- Given a file named "features/wired.feature" with:
42
- """
43
- Feature: High strung
44
- Scenario: Wired
45
- Given we're all wired
46
-
47
- """
48
- And a file named "features/step_definitions/some_remote_place.wire" with:
49
- """
50
- host: localhost
51
- port: 54321
52
-
53
- """
54
-
55
-
56
- #
57
- # # Request: 'step_matches'
58
- #
59
- # When the features have been parsed, Cucumber will send a step_matches
60
- # message to ask the wire server if it can match a step name. This happens for
61
- # each of the steps in each of the features.
62
- #
63
- # The wire server replies with an array of StepMatch objects.
64
-
65
- Scenario: Dry run finds no step match
66
- Given there is a wire server running on port 54321 which understands the following protocol:
67
- | request | response |
68
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
69
- When I run `cucumber --dry-run --no-snippets -f progress`
70
- And it should pass with:
71
- """
72
- U
73
-
74
- 1 scenario (1 undefined)
75
- 1 step (1 undefined)
76
-
77
- """
78
-
79
- # When each StepMatch is returned, it contains the following data:
80
- # * id - identifier for the step definition to be used later when if it
81
- # needs to be invoked. The identifier can be any string value and
82
- # is simply used for the wire server's own reference.
83
- # * args - any argument values as captured by the wire end's own regular
84
- # expression (or other argument matching) process.
85
- Scenario: Dry run finds a step match
86
- Given there is a wire server running on port 54321 which understands the following protocol:
87
- | request | response |
88
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
89
- When I run `cucumber --dry-run -f progress`
90
- And it should pass with:
91
- """
92
- -
93
-
94
- 1 scenario (1 skipped)
95
- 1 step (1 skipped)
96
-
97
- """
98
-
99
- # Optionally, the StepMatch can also contain a source reference, and a native
100
- # regexp string which will be used by some formatters.
101
- Scenario: Step matches returns details about the remote step definition
102
- Given there is a wire server running on port 54321 which understands the following protocol:
103
- | request | response |
104
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[], "source":"MyApp.MyClass:123", "regexp":"we.*"}]] |
105
- When I run `cucumber -f stepdefs --dry-run`
106
- Then it should pass with:
107
- """
108
- -
109
-
110
- we.* # MyApp.MyClass:123
111
-
112
- 1 scenario (1 skipped)
113
- 1 step (1 skipped)
114
-
115
- """
116
- And the stderr should not contain anything
117
-
118
-
119
- #
120
- # # Request: 'invoke'
121
- #
122
- # Assuming a StepMatch was returned for a given step name, when it's time to
123
- # invoke that step definition, Cucumber will send an invoke message.
124
- #
125
- # The invoke message contains the ID of the step definition, as returned by
126
- # the wire server in response to the the step_matches call, along with the
127
- # arguments that were parsed from the step name during the same step_matches
128
- # call.
129
- #
130
- # The wire server will normally[1] reply one of the following:
131
- # * success
132
- # * fail
133
- # * pending : optionally takes a message argument
134
- #
135
- # [1] This isn't the whole story: see also wire_protocol_table_diffing.feature
136
- #
137
-
138
- # ## Pending Steps
139
- #
140
- @spawn
141
- Scenario: Invoke a step definition which is pending
142
- Given there is a wire server running on port 54321 which understands the following protocol:
143
- | request | response |
144
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
145
- | ["begin_scenario"] | ["success"] |
146
- | ["invoke",{"id":"1","args":[]}] | ["pending", "I'll do it later"] |
147
- | ["end_scenario"] | ["success"] |
148
- When I run `cucumber -f pretty -q`
149
- And it should pass with:
150
- """
151
- Feature: High strung
152
-
153
- Scenario: Wired
154
- Given we're all wired
155
- I'll do it later (Cucumber::Pending)
156
- features/wired.feature:3:in `Given we're all wired'
157
-
158
- 1 scenario (1 pending)
159
- 1 step (1 pending)
160
-
161
- """
162
-
163
- # ## Passing Steps
164
- #
165
- Scenario: Invoke a step definition which passes
166
- Given there is a wire server running on port 54321 which understands the following protocol:
167
- | request | response |
168
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
169
- | ["begin_scenario"] | ["success"] |
170
- | ["invoke",{"id":"1","args":[]}] | ["success"] |
171
- | ["end_scenario"] | ["success"] |
172
- When I run `cucumber -f progress`
173
- And it should pass with:
174
- """
175
- .
176
-
177
- 1 scenario (1 passed)
178
- 1 step (1 passed)
179
-
180
- """
181
-
182
- # ## Failing Steps
183
- #
184
- # When an invoked step definition fails, it can return details of the exception
185
- # in the reply to invoke. This causes a Cucumber::WireSupport::WireException to be
186
- # raised.
187
- #
188
- # Valid arguments are:
189
- # * message (mandatory)
190
- # * exception
191
- # * backtrace
192
- #
193
- # See the specs for Cucumber::WireSupport::WireException for more details
194
- #
195
- @spawn
196
- Scenario: Invoke a step definition which fails
197
- Given there is a wire server running on port 54321 which understands the following protocol:
198
- | request | response |
199
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
200
- | ["begin_scenario"] | ["success"] |
201
- | ["invoke",{"id":"1","args":[]}] | ["fail",{"message":"The wires are down", "exception":"Some.Foreign.ExceptionType"}] |
202
- | ["end_scenario"] | ["success"] |
203
- When I run `cucumber -f progress`
204
- Then the stderr should not contain anything
205
- And it should fail with:
206
- """
207
- F
208
-
209
- (::) failed steps (::)
210
-
211
- The wires are down (Some.Foreign.ExceptionType from localhost:54321)
212
- features/wired.feature:3:in `Given we're all wired'
213
-
214
- Failing Scenarios:
215
- cucumber features/wired.feature:2 # Scenario: Wired
216
-
217
- 1 scenario (1 failed)
218
- 1 step (1 failed)
219
-
220
- """
221
-
222
- # ## Step Arguments
223
- #
224
- # Imagine we have a step definition like:
225
- #
226
- # Given /we're all (.*)/ do | what_we_are |
227
- # end
228
- #
229
- # When this step definition matches the step name in our feature, the word
230
- # 'wired' will be captured as an argument.
231
- #
232
- # Cucumber expects this StepArgument to be returned in the StepMatch. The keys
233
- # have the following meanings:
234
- # * val : the value of the string captured for that argument from the step
235
- # name passed in step_matches
236
- # * pos : the position within the step name that the argument was matched
237
- # (used for formatter highlighting)
238
- #
239
- Scenario: Invoke a step definition which takes string arguments (and passes)
240
- Given there is a wire server running on port 54321 which understands the following protocol:
241
- | request | response |
242
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[{"val":"wired", "pos":10}]}]] |
243
- | ["begin_scenario"] | ["success"] |
244
- | ["invoke",{"id":"1","args":["wired"]}] | ["success"] |
245
- | ["end_scenario"] | ["success"] |
246
- When I run `cucumber -f progress`
247
- Then the stderr should not contain anything
248
- And it should pass with:
249
- """
250
- .
251
-
252
- 1 scenario (1 passed)
253
- 1 step (1 passed)
254
-
255
- """
256
-
257
- # ## Multiline Table Arguments
258
- #
259
- # When the step has a multiline table argument, it will be passed with the
260
- # invoke message as a string - a serialized JSON array of array of strings.
261
- # In the following scenario our step definition takes two arguments - one
262
- # captures the "we're" and the other takes the table.
263
- Scenario: Invoke a step definition which takes table arguments (and passes)
264
- Given a file named "features/wired_on_tables.feature" with:
265
- """
266
- Feature: High strung
267
- Scenario: Wired and more
268
- Given we're all:
269
- | wired |
270
- | high |
271
- | happy |
272
- """
273
- And there is a wire server running on port 54321 which understands the following protocol:
274
- | request | response |
275
- | ["step_matches",{"name_to_match":"we're all:"}] | ["success",[{"id":"1", "args":[{"val":"we're", "pos":0}]}]] |
276
- | ["begin_scenario"] | ["success"] |
277
- | ["invoke",{"id":"1","args":["we're",[["wired"],["high"],["happy"]]]}] | ["success"] |
278
- | ["end_scenario"] | ["success"] |
279
- When I run `cucumber -f progress features/wired_on_tables.feature`
280
- Then the stderr should not contain anything
281
- And it should pass with:
282
- """
283
- .
284
-
285
- 1 scenario (1 passed)
286
- 1 step (1 passed)
287
-
288
- """
289
-
290
-
291
- #
292
- # # Request: 'snippets'
293
- #
294
- @spawn
295
- Scenario: Wire server returns snippets for a step that didn't match
296
- Given there is a wire server running on port 54321 which understands the following protocol:
297
- | request | response |
298
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
299
- | ["snippet_text",{"step_keyword":"Given","multiline_arg_class":"","step_name":"we're all wired"}] | ["success","foo()\n bar;\nbaz"] |
300
- | ["begin_scenario"] | ["success"] |
301
- | ["end_scenario"] | ["success"] |
302
- When I run `cucumber -f pretty`
303
- Then the stderr should not contain anything
304
- And it should pass with:
305
- """
306
- Feature: High strung
307
-
308
- Scenario: Wired # features/wired.feature:2
309
- Given we're all wired # features/wired.feature:3
310
-
311
- 1 scenario (1 undefined)
312
- 1 step (1 undefined)
313
- """
314
- And the output should contain:
315
- """
316
-
317
- You can implement step definitions for undefined steps with these snippets:
318
-
319
- foo()
320
- bar;
321
- baz
322
-
323
- """
324
-
325
- #
326
- # # Bad Response
327
- #
328
- Scenario: Unexpected response
329
- Given there is a wire server running on port 54321 which understands the following protocol:
330
- | request | response |
331
- | ["begin_scenario"] | ["yikes"] |
332
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
333
- When I run `cucumber -f pretty`
334
- Then the stdout should contain:
335
- """
336
- undefined method `handle_yikes'
337
- """
@@ -1,5 +0,0 @@
1
- <div id="footer">
2
- Generated on <%= Time.now.strftime("%c") %> by
3
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
4
- <%= YARD::VERSION %> (ruby-<%= RUBY_VERSION %>).
5
- </div>
@@ -1 +0,0 @@
1
- <%= yieldall %>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <%= erb(:headers) %>
6
- </head>
7
- <body>
8
- <script type="text/javascript" charset="utf-8">
9
- if (window.top.frames.main) document.body.className = 'frames';
10
- </script>
11
-
12
- <div id="header">
13
- <%= erb(:logo) %>
14
- <%= erb(:breadcrumb) %>
15
- <%= erb(:search) %>
16
- <div class="clear"></div>
17
- </div>
18
-
19
- <iframe id="search_frame"></iframe>
20
-
21
- <div id="content"><%= yieldall %></div>
22
-
23
- <%= erb(:footer) %>
24
- </body>
25
- </html>
@@ -1 +0,0 @@
1
- <h3><img src="<%= url_for('images/bubble_32x32.png') %>"></img> Cucumber <%= Cucumber::VERSION %></h3>
@@ -1,4 +0,0 @@
1
- def init
2
- super
3
- options[:serializer].serialize('/images/bubble_32x32.png', IO.read(File.dirname(__FILE__) + '/bubble_32x32.png'))
4
- end
data/gem_tasks/yard.rake DELETED
@@ -1,43 +0,0 @@
1
- require 'yard'
2
- require 'yard/rake/yardoc_task'
3
- require File.expand_path(File.dirname(__FILE__) + '/../lib/cucumber/platform')
4
-
5
- DOC_DIR = File.expand_path(File.dirname(__FILE__) + '/../doc')
6
- SITE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../cucumber.github.com')
7
- API_DIR = File.join(SITE_DIR, 'api', 'cucumber', 'ruby', 'yardoc')
8
- TEMPLATE_DIR = File.expand_path(File.join(File.dirname(__FILE__), 'yard'))
9
- YARD::Templates::Engine.register_template_path(TEMPLATE_DIR)
10
-
11
- namespace :api do
12
- YARD::Rake::YardocTask.new(:yard) do |yard|
13
- yard.options = ["--out", DOC_DIR]
14
- end
15
-
16
- task :sync_with_git do
17
- unless File.directory?(SITE_DIR)
18
- raise "You need to git clone git@github.com:cucumber/cucumber.github.com.git #{SITE_DIR}"
19
- end
20
- Dir.chdir(SITE_DIR) do
21
- sh 'git pull -u'
22
- end
23
- end
24
-
25
- task :copy_to_website do
26
- rm_rf API_DIR
27
- cp_r DOC_DIR, API_DIR
28
- end
29
-
30
- task :release do
31
- Dir.chdir(SITE_DIR) do
32
- sh 'git add .'
33
- sh '''git commit -m "Update API docs for Cucumber-Ruby v#{Cucumber::VERSION}"'''
34
- sh 'git push'
35
- end
36
- end
37
-
38
- desc "Generate YARD docs for Cucumber's API"
39
- task :doc => [:yard, :sync_with_git, :copy_to_website, :release]
40
-
41
- desc "Build cucumber gem and doc locally"
42
- task :build => [:yard, :sync_with_git, :copy_to_website]
43
- end
@@ -1,238 +0,0 @@
1
- require 'cucumber/runtime'
2
- require 'cucumber'
3
- require 'cucumber/multiline_argument'
4
-
5
- module Cucumber
6
- class Mappings
7
-
8
- def self.for(runtime)
9
- if runtime.dry_run?
10
- Mappings::DryRun.new(runtime)
11
- else
12
- Mappings.new(runtime)
13
- end
14
- end
15
-
16
- def initialize(runtime = nil)
17
- @runtime = runtime
18
- end
19
-
20
- def test_step(step, mapper)
21
- map_step(step, mapper)
22
- map_after_step_hooks(mapper)
23
- end
24
-
25
- def test_case(test_case, mapper)
26
- map_test_case(test_case, mapper)
27
- map_test_case_hooks(mapper)
28
- end
29
-
30
- def runtime
31
- return @runtime if @runtime
32
- result = Cucumber::Runtime.new
33
- result.support_code.load_files!(support_files)
34
- @runtime = result
35
- end
36
-
37
- private
38
-
39
- attr_reader :scenario
40
- private :scenario
41
-
42
- def ruby
43
- @ruby ||= runtime.load_programming_language('rb')
44
- end
45
-
46
- def support_files
47
- Dir['features/**/*.rb']
48
- end
49
-
50
- def map_step(step, mapper)
51
- step.describe_source_to MapStep.new(runtime, mapper)
52
- end
53
-
54
- def map_after_step_hooks(mapper)
55
- ruby.hooks_for(:after_step, scenario).each do |hook|
56
- mapper.after do
57
- hook.invoke 'AfterStep', scenario
58
- end
59
- end
60
- end
61
-
62
- def map_test_case(test_case, mapper)
63
- @scenario = Source.new(test_case).build_scenario
64
- mapper.before do
65
- runtime.begin_scenario(scenario)
66
- end
67
- end
68
-
69
- def map_test_case_hooks(mapper)
70
- ruby.hooks_for(:before, scenario).each do |hook|
71
- mapper.before do |result|
72
- hook.invoke('Before', scenario.with_result(result))
73
- end
74
- end
75
- ruby.hooks_for(:after, scenario).each do |hook|
76
- mapper.after do |result|
77
- hook.invoke('After', scenario.with_result(result))
78
- end
79
- end
80
- ruby.hooks_for(:around, scenario).each do |hook|
81
- mapper.around do |run_scenario|
82
- hook.invoke('Around', scenario, &run_scenario)
83
- end
84
- end
85
- end
86
-
87
- # adapts our test_case to look like the Cucumber Runtime's old Scenario
88
- class TestCase
89
- def initialize(test_case, feature, result = Core::Test::Result::Unknown.new)
90
- @test_case = test_case
91
- @feature = feature
92
- @result = result
93
- end
94
-
95
- def accept_hook?(hook)
96
- hook.tag_expressions.all? { |expression| @test_case.match_tags?(expression) }
97
- end
98
-
99
- def failed?
100
- @result.failed?
101
- end
102
-
103
- def language
104
- @test_case.language
105
- end
106
-
107
- def feature
108
- @feature
109
- end
110
-
111
- def name
112
- @test_case.name
113
- end
114
-
115
- def title
116
- warn("deprecated: call #name instead")
117
- name
118
- end
119
-
120
- def source_tags
121
- #warn('deprecated: call #tags instead')
122
- tags
123
- end
124
-
125
- def source_tag_names
126
- tags.map &:name
127
- end
128
-
129
- def tags
130
- @test_case.tags
131
- end
132
-
133
- def outline?
134
- false
135
- end
136
-
137
- def with_result(result)
138
- self.class.new(@test_case, @feature, result)
139
- end
140
- end
141
-
142
- class Scenario < TestCase
143
- end
144
-
145
- class ScenarioOutlineExample < TestCase
146
- def outline?
147
- true
148
- end
149
-
150
- def scenario_outline
151
- self
152
- end
153
- end
154
-
155
- class Source
156
- def initialize(test_case)
157
- @test_case = test_case
158
- test_case.describe_source_to(self)
159
- end
160
-
161
- def feature(feature)
162
- @feature = feature
163
- end
164
-
165
- def scenario(scenario)
166
- @factory = Scenario
167
- end
168
-
169
- def scenario_outline(scenario)
170
- @factory = ScenarioOutlineExample
171
- end
172
-
173
- def examples_table(examples_table)
174
- end
175
-
176
- def examples_table_row(row)
177
- end
178
-
179
- def build_scenario
180
- @factory.new(@test_case, Feature.new(@feature.legacy_conflated_name_and_description))
181
- end
182
- end
183
-
184
- class DryRun < Mappings
185
-
186
- private
187
-
188
- def map_test_case(*)
189
- # NOOP - we don't want to create World etc for dry run
190
- end
191
-
192
- def map_step(step, mapper)
193
- step.describe_source_to MapStep::DryRun.new(runtime, mapper)
194
- end
195
-
196
- def map_after_step_hooks(mapper)
197
- # NOOP - we don't need after step hooks for dry run
198
- end
199
-
200
- def map_test_case_hooks(mapper)
201
- # NOOP - we don't need hooks for dry run
202
- end
203
- end
204
-
205
- Feature = Struct.new(:name)
206
-
207
- class MapStep
208
- include Cucumber.initializer(:runtime, :mapper)
209
-
210
- def step(node)
211
- step_match = runtime.step_match(node.name)
212
- map_step(node, step_match)
213
- rescue Cucumber::Undefined
214
- end
215
-
216
- def feature(*);end
217
- def scenario(*);end
218
- def background(*);end
219
- def scenario_outline(*);end
220
- def examples_table(*);end
221
- def examples_table_row(*);end
222
-
223
- private
224
- def map_step(node, step_match)
225
- multiline_arg = MultilineArgument.from_core(node.multiline_arg)
226
- mapper.map { step_match.invoke(multiline_arg) }
227
- end
228
-
229
- class DryRun < MapStep
230
- private
231
- def map_step(node, step_match)
232
- mapper.map { raise Core::Test::Result::Skipped, "dry run" }
233
- end
234
- end
235
- end
236
-
237
- end
238
- end