cucumber 1.3.20 → 2.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (404) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.rspec +1 -1
  4. data/.travis.yml +1 -2
  5. data/CONTRIBUTING.md +9 -0
  6. data/Gemfile +9 -2
  7. data/History.md +26 -17
  8. data/LICENSE +2 -2
  9. data/README.md +4 -4
  10. data/Rakefile +12 -0
  11. data/bin/cucumber +1 -5
  12. data/bin/cuke +60 -0
  13. data/cucumber.gemspec +10 -15
  14. data/cucumber.yml +14 -26
  15. data/examples/i18n/ar/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  16. data/examples/i18n/bg/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  17. data/examples/i18n/ca/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  18. data/examples/i18n/cs/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  19. data/examples/i18n/da/features/{step_definitons → step_definitions}/lommeregner_steps.rb +0 -0
  20. data/examples/i18n/de/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  21. data/examples/{ramaze → i18n/el}/Rakefile +1 -1
  22. data/examples/i18n/el/features/addition.feature +17 -0
  23. data/examples/i18n/el/features/division.feature +10 -0
  24. data/examples/i18n/el/features/step_definitions/calculator_steps.rb +24 -0
  25. data/examples/i18n/el/lib/calculator.rb +14 -0
  26. data/examples/i18n/en/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  27. data/examples/i18n/eo/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  28. data/examples/i18n/es/features/{step_definitons → step_definitions}/calculador_steps.rb +0 -0
  29. data/examples/i18n/fi/features/{step_definitons → step_definitions}/laskin_steps.rb +0 -0
  30. data/examples/i18n/fr/Rakefile +3 -1
  31. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +2 -2
  32. data/examples/i18n/he/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  33. data/examples/i18n/hi/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  34. data/examples/i18n/hu/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  35. data/examples/i18n/id/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  36. data/examples/i18n/it/features/{step_definitons → step_definitions}/calcolatrice_steps.rb +0 -0
  37. data/examples/i18n/ja/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  38. data/examples/i18n/ko/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  39. data/examples/i18n/lt/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  40. data/examples/i18n/lv/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  41. data/examples/i18n/no/features/{step_definitons → step_definitions}/kalkulator_steps.rb +0 -0
  42. data/examples/i18n/pl/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  43. data/examples/i18n/ro/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  44. data/examples/i18n/ru/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  45. data/examples/i18n/sk/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  46. data/examples/i18n/sr-Cyrl/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  47. data/examples/i18n/sr-Latn/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  48. data/examples/i18n/sv/features/{step_definitons → step_definitions}/kalkulator_steps.rb +0 -0
  49. data/examples/i18n/tr/features/{step_definitons → step_definitions}/hesap_makinesi_adimlari.rb +0 -0
  50. data/examples/i18n/uk/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  51. data/examples/i18n/uz/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  52. data/examples/i18n/zh-CN/features/{step_definitons → step_definitions}/calculator_steps.rb +4 -4
  53. data/examples/i18n/zh-TW/features/{step_definitons → step_definitions}/calculator_steps.rb +0 -0
  54. data/{legacy_features → features/docs}/api/list_step_defs_as_json.feature +14 -14
  55. data/{legacy_features → features/docs}/api/run_cli_main_with_existing_runtime.feature +5 -10
  56. data/features/{backtraces.feature → docs/cli/backtraces.feature} +2 -2
  57. data/features/docs/cli/dry_run.feature +25 -0
  58. data/features/docs/cli/exclude_files.feature +19 -0
  59. data/features/docs/cli/execute_with_tag_filter.feature +117 -0
  60. data/features/docs/cli/randomize.feature +46 -0
  61. data/features/docs/cli/require.feature +27 -0
  62. data/features/docs/cli/run_scenarios_matching_name.feature +104 -0
  63. data/features/docs/cli/run_specific_scenarios.feature +113 -0
  64. data/features/docs/cli/showing_differences.feature +43 -0
  65. data/features/docs/cli/specifying_multiple_formatters.feature +44 -0
  66. data/features/docs/cli/strict_mode.feature +41 -0
  67. data/features/{nested_steps.feature → docs/defining_steps/nested_steps.feature} +3 -5
  68. data/features/{nested_steps_i18n.feature → docs/defining_steps/nested_steps_i18n.feature} +0 -2
  69. data/features/{nested_steps_with_second_arg.feature → docs/defining_steps/nested_steps_with_second_arg.feature} +0 -0
  70. data/features/{step_definitions.feature → docs/defining_steps/one_line_step_definitions.feature} +3 -3
  71. data/features/docs/defining_steps/printing_messages.feature +147 -0
  72. data/features/docs/defining_steps/skip_scenario.feature +33 -0
  73. data/features/docs/defining_steps/snippets.feature +41 -0
  74. data/{legacy_features → features/docs/defining_steps}/table_diffing.feature +15 -15
  75. data/features/{transforms.feature → docs/defining_steps/transforms.feature} +2 -2
  76. data/{legacy_features/exception_in_after_block.feature → features/docs/exception_in_after_hook.feature} +25 -26
  77. data/{legacy_features/exception_in_after_step_block.feature → features/docs/exception_in_after_step_hook.feature} +21 -24
  78. data/{legacy_features/exception_in_before_block.feature → features/docs/exception_in_before_hook.feature} +18 -20
  79. data/features/{custom_formatter.feature → docs/extending_cucumber/custom_formatter.feature} +3 -8
  80. data/features/{formatter_callbacks.feature → docs/extending_cucumber/formatter_callbacks.feature} +185 -4
  81. data/{legacy_features/listener_debugger_formatter.feature → features/docs/formatters/debug_formatter.feature} +13 -15
  82. data/features/{formatter_step_file_colon_line.feature → docs/formatters/formatter_step_file_colon_line.feature} +2 -4
  83. data/features/{html_formatter.feature → docs/formatters/html_formatter.feature} +10 -14
  84. data/features/{json_formatter.feature → docs/formatters/json_formatter.feature} +109 -247
  85. data/features/docs/formatters/junit_formatter.feature +275 -0
  86. data/features/{pretty_formatter.feature → docs/formatters/pretty_formatter.feature} +1 -1
  87. data/features/{progress_formatter.feature → docs/formatters/progress_formatter.feature} +1 -1
  88. data/features/docs/formatters/rerun_formatter.feature +135 -0
  89. data/features/docs/formatters/usage_formatter.feature +102 -0
  90. data/features/docs/getting_started.feature +27 -0
  91. data/features/{background.feature → docs/gherkin/background.feature} +149 -91
  92. data/features/{doc_strings.feature → docs/gherkin/doc_strings.feature} +1 -0
  93. data/features/docs/gherkin/expand_option_for_outlines.feature +46 -0
  94. data/features/docs/gherkin/language_from_header.feature +32 -0
  95. data/features/docs/gherkin/outlines.feature +154 -0
  96. data/features/docs/gherkin/unicode_table.feature +32 -0
  97. data/features/docs/gherkin/using_descriptions.feature +88 -0
  98. data/features/docs/gherkin/using_star_notation.feature +37 -0
  99. data/features/{iso-8859-1.feature → docs/iso-8859-1.feature} +0 -0
  100. data/{legacy_features → features/docs}/post_configuration_hook.feature +17 -18
  101. data/{legacy_features → features/docs}/profiles.feature +30 -36
  102. data/{legacy_features → features/docs}/rake_task.feature +30 -41
  103. data/features/{raketask.feature → docs/raketask.feature} +6 -13
  104. data/features/docs/report_called_undefined_steps.feature +57 -0
  105. data/{legacy_features → features/docs}/wire_protocol.feature +36 -31
  106. data/{legacy_features → features/docs}/wire_protocol_erb.feature +5 -6
  107. data/{legacy_features → features/docs}/wire_protocol_table_diffing.feature +14 -12
  108. data/{legacy_features → features/docs}/wire_protocol_tags.feature +6 -7
  109. data/{legacy_features → features/docs}/wire_protocol_timeouts.feature +6 -6
  110. data/{legacy_features → features/docs}/work_in_progress.feature +52 -54
  111. data/{legacy_features → features/docs/writing_support_code}/around_hooks.feature +25 -28
  112. data/features/docs/writing_support_code/before_hook.feature +61 -0
  113. data/features/docs/writing_support_code/hook_order.feature +61 -0
  114. data/features/{load_path.feature → docs/writing_support_code/load_path.feature} +3 -0
  115. data/features/docs/writing_support_code/state.feature +32 -0
  116. data/features/{tagged_hooks.feature → docs/writing_support_code/tagged_hooks.feature} +11 -13
  117. data/features/lib/step_definitions/aruba_steps.rb +22 -0
  118. data/features/lib/step_definitions/cucumber_steps.rb +50 -0
  119. data/features/{step_definitions → lib/step_definitions}/iso-8859-1_steps.rb +3 -15
  120. data/features/lib/step_definitions/json_steps.rb +7 -0
  121. data/features/lib/step_definitions/junit_steps.rb +13 -0
  122. data/features/lib/step_definitions/language_steps.rb +4 -5
  123. data/features/lib/step_definitions/profile_steps.rb +15 -0
  124. data/features/lib/step_definitions/ruby_steps.rb +3 -0
  125. data/{legacy_features → features/lib}/step_definitions/wire_steps.rb +16 -9
  126. data/features/lib/support/env.rb +21 -0
  127. data/{legacy_features → features/lib}/support/fake_wire_server.rb +0 -0
  128. data/features/{support → lib/support}/feature_factory.rb +1 -1
  129. data/features/lib/support/normalise_output.rb +33 -0
  130. data/gem_tasks/cov.rake +5 -0
  131. data/gem_tasks/cucumber.rake +1 -10
  132. data/gem_tasks/rspec.rake +0 -2
  133. data/gem_tasks/yard.rake +4 -1
  134. data/lib/cucumber.rb +1 -3
  135. data/lib/cucumber/cli/configuration.rb +30 -25
  136. data/lib/cucumber/cli/main.rb +13 -25
  137. data/lib/cucumber/cli/options.rb +15 -57
  138. data/lib/cucumber/configuration.rb +4 -0
  139. data/lib/cucumber/constantize.rb +7 -6
  140. data/lib/cucumber/core_ext/instance_exec.rb +7 -38
  141. data/lib/cucumber/core_ext/proc.rb +1 -1
  142. data/lib/cucumber/errors.rb +3 -1
  143. data/lib/cucumber/file_specs.rb +35 -0
  144. data/lib/cucumber/formatter/console.rb +32 -21
  145. data/lib/cucumber/formatter/debug.rb +5 -0
  146. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +8 -38
  147. data/lib/cucumber/formatter/html.rb +29 -21
  148. data/lib/cucumber/formatter/junit.rb +10 -7
  149. data/lib/cucumber/formatter/pretty.rb +2 -8
  150. data/lib/cucumber/formatter/rerun.rb +2 -3
  151. data/lib/cucumber/formatter/unicode.rb +8 -21
  152. data/lib/cucumber/formatter/usage.rb +65 -2
  153. data/lib/cucumber/language_support/language_methods.rb +1 -1
  154. data/lib/cucumber/mappings.rb +212 -0
  155. data/lib/cucumber/multiline_argument.rb +115 -0
  156. data/lib/cucumber/platform.rb +21 -22
  157. data/lib/cucumber/rake/task.rb +3 -54
  158. data/lib/cucumber/rb_support/rb_language.rb +2 -5
  159. data/lib/cucumber/rb_support/rb_world.rb +14 -19
  160. data/lib/cucumber/rb_support/snippet.rb +60 -19
  161. data/lib/cucumber/reports/legacy_formatter.rb +1279 -0
  162. data/lib/cucumber/runtime.rb +176 -26
  163. data/lib/cucumber/runtime/for_programming_languages.rb +10 -4
  164. data/lib/cucumber/runtime/gated_receiver.rb +21 -0
  165. data/lib/cucumber/runtime/support_code.rb +9 -7
  166. data/lib/cucumber/runtime/tag_limits.rb +15 -0
  167. data/lib/cucumber/runtime/tag_limits/filter.rb +31 -0
  168. data/lib/cucumber/runtime/tag_limits/test_case_index.rb +29 -0
  169. data/lib/cucumber/runtime/tag_limits/verifier.rb +57 -0
  170. data/lib/cucumber/runtime/user_interface.rb +4 -0
  171. data/lib/cucumber/step_match.rb +3 -3
  172. data/lib/cucumber/term/ansicolor.rb +1 -9
  173. data/lib/cucumber/wire_support/wire_language.rb +23 -9
  174. data/lib/cucumber/wire_support/wire_packet.rb +1 -1
  175. data/lib/cucumber/wire_support/wire_protocol/requests.rb +13 -5
  176. data/lib/cucumber/wire_support/wire_step_definition.rb +1 -8
  177. data/spec/cucumber/cli/configuration_spec.rb +151 -150
  178. data/spec/cucumber/cli/main_spec.rb +36 -99
  179. data/spec/cucumber/cli/options_spec.rb +238 -272
  180. data/spec/cucumber/cli/profile_loader_spec.rb +9 -8
  181. data/spec/cucumber/configuration_spec.rb +3 -3
  182. data/spec/cucumber/constantize_spec.rb +2 -1
  183. data/spec/cucumber/core_ext/proc_spec.rb +32 -43
  184. data/spec/cucumber/file_specs_spec.rb +41 -0
  185. data/spec/cucumber/formatter/ansicolor_spec.rb +11 -10
  186. data/spec/cucumber/formatter/debug_spec.rb +569 -0
  187. data/spec/cucumber/formatter/duration_spec.rb +6 -6
  188. data/spec/cucumber/formatter/html_spec.rb +53 -62
  189. data/spec/cucumber/formatter/interceptor_spec.rb +38 -31
  190. data/spec/cucumber/formatter/junit_spec.rb +34 -28
  191. data/spec/cucumber/formatter/pretty_spec.rb +238 -52
  192. data/spec/cucumber/formatter/progress_spec.rb +2 -2
  193. data/spec/cucumber/formatter/spec_helper.rb +23 -17
  194. data/spec/cucumber/rake/forked_spec.rb +13 -22
  195. data/spec/cucumber/rb_support/rb_language_spec.rb +76 -67
  196. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +63 -42
  197. data/spec/cucumber/rb_support/rb_transform_spec.rb +4 -3
  198. data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +6 -4
  199. data/spec/cucumber/rb_support/snippet_spec.rb +42 -33
  200. data/spec/cucumber/reports/legacy_formatter_spec.rb +1750 -0
  201. data/spec/cucumber/runtime/for_programming_languages_spec.rb +11 -10
  202. data/spec/cucumber/runtime/gated_receiver_spec.rb +47 -0
  203. data/spec/cucumber/runtime/results_spec.rb +33 -26
  204. data/spec/cucumber/runtime/support_code_spec.rb +29 -29
  205. data/spec/cucumber/runtime/tag_limits/filter_spec.rb +59 -0
  206. data/spec/cucumber/runtime/tag_limits/test_case_index_spec.rb +38 -0
  207. data/spec/cucumber/runtime/tag_limits/verifier_spec.rb +57 -0
  208. data/spec/cucumber/runtime_spec.rb +39 -34
  209. data/spec/cucumber/step_match_spec.rb +30 -20
  210. data/spec/cucumber/wire_support/configuration_spec.rb +8 -5
  211. data/spec/cucumber/wire_support/connection_spec.rb +12 -8
  212. data/spec/cucumber/wire_support/wire_exception_spec.rb +14 -8
  213. data/spec/cucumber/wire_support/wire_language_spec.rb +8 -9
  214. data/spec/cucumber/wire_support/wire_packet_spec.rb +17 -13
  215. data/spec/cucumber/world/pending_spec.rb +36 -36
  216. data/spec/simplecov_setup.rb +18 -0
  217. data/spec/spec_helper.rb +3 -9
  218. metadata +298 -507
  219. data/.gitattributes +0 -1
  220. data/.ruby-version +0 -1
  221. data/examples/python/README.textile +0 -8
  222. data/examples/python/Rakefile +0 -4
  223. data/examples/python/features/fibonacci.feature +0 -19
  224. data/examples/python/features/step_definitions/fib_steps.py +0 -11
  225. data/examples/python/lib/fib.py +0 -7
  226. data/examples/ramaze/README.textile +0 -7
  227. data/examples/ramaze/app.rb +0 -21
  228. data/examples/ramaze/features/add.feature +0 -11
  229. data/examples/ramaze/features/step_definitions/add_steps.rb +0 -15
  230. data/examples/ramaze/features/support/env.rb +0 -32
  231. data/examples/ramaze/layout/default.html.erb +0 -8
  232. data/examples/ramaze/view/index.html.erb +0 -5
  233. data/examples/ruby2python/README.textile +0 -8
  234. data/examples/ruby2python/Rakefile +0 -4
  235. data/examples/ruby2python/features/fibonacci.feature +0 -19
  236. data/examples/ruby2python/features/step_definitions/fib_steps.rb +0 -7
  237. data/examples/ruby2python/features/support/env.rb +0 -21
  238. data/examples/ruby2python/lib/fib.py +0 -7
  239. data/examples/v8/Rakefile +0 -6
  240. data/examples/v8/features/fibonacci.feature +0 -43
  241. data/examples/v8/features/step_definitions/fib_steps.js +0 -49
  242. data/examples/v8/features/support/env.js +0 -14
  243. data/examples/v8/lib/fibonacci.js +0 -19
  244. data/features/.cucumber/stepdefs.json +0 -722
  245. data/features/assertions.feature +0 -73
  246. data/features/autoformat_profile_output.feature +0 -23
  247. data/features/before_hook.feature +0 -43
  248. data/features/bootstrap.feature +0 -26
  249. data/features/drb_server_integration.feature +0 -63
  250. data/features/execute_with_tag_filter.feature +0 -63
  251. data/features/parsing.feature +0 -18
  252. data/features/rerun_formatter.feature +0 -99
  253. data/features/run_specific_scenarios.feature +0 -47
  254. data/features/stats_formatters.feature +0 -73
  255. data/features/step_definitions/cucumber-features/cucumber_ruby_mappings.rb +0 -197
  256. data/features/step_definitions/cucumber_steps.rb +0 -57
  257. data/features/step_definitions/drb_steps.rb +0 -3
  258. data/features/support/env.rb +0 -57
  259. data/fixtures/json/features/background.feature +0 -7
  260. data/fixtures/json/features/embed.feature +0 -4
  261. data/fixtures/json/features/one_passing_one_failing.feature +0 -11
  262. data/fixtures/json/features/step_definitions/steps.rb +0 -32
  263. data/fixtures/json/features/tables.feature +0 -13
  264. data/fixtures/junit/features/one_passing_one_failing.feature +0 -8
  265. data/fixtures/junit/features/pending.feature +0 -7
  266. data/fixtures/junit/features/scenario_outline.feature +0 -9
  267. data/fixtures/junit/features/some_subdirectory/one_passing_one_failing.feature +0 -8
  268. data/fixtures/junit/features/step_definitions/steps.rb +0 -11
  269. data/fixtures/self_test/README.textile +0 -6
  270. data/fixtures/self_test/Rakefile +0 -6
  271. data/fixtures/self_test/features/call_undefined_step_from_step_def.feature +0 -7
  272. data/fixtures/self_test/features/failing_expectation.feature +0 -4
  273. data/fixtures/self_test/features/lots_of_undefined.feature +0 -8
  274. data/fixtures/self_test/features/multiline_name.feature +0 -27
  275. data/fixtures/self_test/features/outline_sample.feature +0 -15
  276. data/fixtures/self_test/features/sample.feature +0 -21
  277. data/fixtures/self_test/features/search_sample.feature +0 -32
  278. data/fixtures/self_test/features/step_definitions/sample_steps.rb +0 -84
  279. data/fixtures/self_test/features/support/bubble_256x256.png +0 -0
  280. data/fixtures/self_test/features/support/env.rb +0 -26
  281. data/fixtures/self_test/features/tags_sample.feature +0 -17
  282. data/fixtures/self_test/features/tons_of_cukes.feature +0 -52
  283. data/fixtures/self_test/features/undefined_multiline_args.feature +0 -12
  284. data/fixtures/self_test/list-of-features.txt +0 -1
  285. data/fixtures/steps_library/features/step_definitions/steps_lib1.rb +0 -8
  286. data/fixtures/steps_library/features/step_definitions/steps_lib2.rb +0 -8
  287. data/fixtures/tickets/Rakefile +0 -20
  288. data/fixtures/tickets/features.html +0 -138
  289. data/fixtures/tickets/features/172.feature +0 -28
  290. data/fixtures/tickets/features/177/1.feature +0 -28
  291. data/fixtures/tickets/features/177/2.feature +0 -20
  292. data/fixtures/tickets/features/177/3.feature +0 -18
  293. data/fixtures/tickets/features/180.feature +0 -7
  294. data/fixtures/tickets/features/229/tagged_hooks.feature +0 -8
  295. data/fixtures/tickets/features/229/tagged_hooks.rb +0 -14
  296. data/fixtures/tickets/features/236.feature +0 -13
  297. data/fixtures/tickets/features/241.feature +0 -12
  298. data/fixtures/tickets/features/246.feature +0 -4
  299. data/fixtures/tickets/features/248.feature +0 -11
  300. data/fixtures/tickets/features/270/back.feature +0 -14
  301. data/fixtures/tickets/features/270/back.steps.rb +0 -14
  302. data/fixtures/tickets/features/272/hooks.feature +0 -26
  303. data/fixtures/tickets/features/272/hooks_steps.rb +0 -53
  304. data/fixtures/tickets/features/279/py_string_indent.feature +0 -25
  305. data/fixtures/tickets/features/279/py_string_indent.steps.rb +0 -12
  306. data/fixtures/tickets/features/279/wrong.feature_ +0 -11
  307. data/fixtures/tickets/features/301/filter_background_tagged_hooks.feature +0 -6
  308. data/fixtures/tickets/features/301/filter_background_tagged_hooks_steps.rb +0 -12
  309. data/fixtures/tickets/features/306/only_background.feature +0 -4
  310. data/fixtures/tickets/features/around_timeout.feature +0 -6
  311. data/fixtures/tickets/features/gherkin_67.feature +0 -12
  312. data/fixtures/tickets/features/gherkin_68.feature +0 -4
  313. data/fixtures/tickets/features/half_manual.feature +0 -11
  314. data/fixtures/tickets/features/lib/eatting_machine.rb +0 -18
  315. data/fixtures/tickets/features/lib/pantry.rb +0 -20
  316. data/fixtures/tickets/features/scenario_outline.feature +0 -95
  317. data/fixtures/tickets/features/step_definitons/246_steps.rb +0 -3
  318. data/fixtures/tickets/features/step_definitons/248_steps.rb +0 -15
  319. data/fixtures/tickets/features/step_definitons/around_timeout_steps.rb +0 -9
  320. data/fixtures/tickets/features/step_definitons/half_manual_steps.rb +0 -11
  321. data/fixtures/tickets/features/step_definitons/scenario_outline_steps.rb +0 -42
  322. data/fixtures/tickets/features/step_definitons/tickets_steps.rb +0 -88
  323. data/fixtures/tickets/features/table_diffing.feature +0 -13
  324. data/fixtures/tickets/features/tickets.feature +0 -28
  325. data/legacy_features/README.md +0 -14
  326. data/legacy_features/announce.feature +0 -152
  327. data/legacy_features/bug_371.feature +0 -32
  328. data/legacy_features/bug_464.feature +0 -16
  329. data/legacy_features/bug_475.feature +0 -42
  330. data/legacy_features/bug_585_tab_indentation.feature +0 -22
  331. data/legacy_features/bug_600.feature +0 -73
  332. data/legacy_features/cucumber_cli.feature +0 -584
  333. data/legacy_features/cucumber_cli_outlines.feature +0 -117
  334. data/legacy_features/default_snippets.feature +0 -43
  335. data/legacy_features/diffing.feature +0 -25
  336. data/legacy_features/drb_server_integration.feature +0 -174
  337. data/legacy_features/exclude_files.feature +0 -20
  338. data/legacy_features/expand.feature +0 -60
  339. data/legacy_features/junit_formatter.feature +0 -214
  340. data/legacy_features/language_from_header.feature +0 -30
  341. data/legacy_features/multiline_names.feature +0 -44
  342. data/legacy_features/report_called_undefined_steps.feature +0 -35
  343. data/legacy_features/rerun_formatter.feature +0 -52
  344. data/legacy_features/simplest.feature +0 -11
  345. data/legacy_features/snippet.feature +0 -23
  346. data/legacy_features/snippets_when_using_star_keyword.feature +0 -38
  347. data/legacy_features/step_definitions/cucumber_steps.rb +0 -179
  348. data/legacy_features/step_definitions/extra_steps.rb +0 -2
  349. data/legacy_features/step_definitions/simplest_steps.rb +0 -3
  350. data/legacy_features/support/env.rb +0 -161
  351. data/legacy_features/support/env.rb.simplest +0 -7
  352. data/legacy_features/table_mapping.feature +0 -34
  353. data/legacy_features/transform.feature +0 -245
  354. data/legacy_features/unicode_table.feature +0 -35
  355. data/lib/README.rdoc +0 -12
  356. data/lib/cucumber/ast.rb +0 -30
  357. data/lib/cucumber/ast/background.rb +0 -116
  358. data/lib/cucumber/ast/comment.rb +0 -31
  359. data/lib/cucumber/ast/doc_string.rb +0 -61
  360. data/lib/cucumber/ast/empty_background.rb +0 -33
  361. data/lib/cucumber/ast/examples.rb +0 -49
  362. data/lib/cucumber/ast/feature.rb +0 -99
  363. data/lib/cucumber/ast/features.rb +0 -38
  364. data/lib/cucumber/ast/has_steps.rb +0 -74
  365. data/lib/cucumber/ast/location.rb +0 -41
  366. data/lib/cucumber/ast/multiline_argument.rb +0 -30
  367. data/lib/cucumber/ast/names.rb +0 -13
  368. data/lib/cucumber/ast/outline_table.rb +0 -194
  369. data/lib/cucumber/ast/scenario.rb +0 -103
  370. data/lib/cucumber/ast/scenario_outline.rb +0 -146
  371. data/lib/cucumber/ast/step.rb +0 -122
  372. data/lib/cucumber/ast/step_collection.rb +0 -92
  373. data/lib/cucumber/ast/step_invocation.rb +0 -196
  374. data/lib/cucumber/ast/table.rb +0 -738
  375. data/lib/cucumber/ast/tags.rb +0 -28
  376. data/lib/cucumber/ast/tree_walker.rb +0 -191
  377. data/lib/cucumber/ast/visitor.rb +0 -11
  378. data/lib/cucumber/broadcaster.rb +0 -13
  379. data/lib/cucumber/cli/drb_client.rb +0 -43
  380. data/lib/cucumber/feature_file.rb +0 -101
  381. data/lib/cucumber/formatter/ordered_xml_markup.rb +0 -24
  382. data/lib/cucumber/js_support/js_dsl.js +0 -57
  383. data/lib/cucumber/js_support/js_language.rb +0 -185
  384. data/lib/cucumber/js_support/js_snippets.rb +0 -27
  385. data/lib/cucumber/parser.rb +0 -2
  386. data/lib/cucumber/parser/gherkin_builder.rb +0 -284
  387. data/lib/cucumber/py_support/py_dsl.py +0 -10
  388. data/lib/cucumber/py_support/py_language.py +0 -10
  389. data/lib/cucumber/py_support/py_language.rb +0 -80
  390. data/lib/cucumber/step_mother.rb +0 -10
  391. data/spec/cucumber/ast/background_spec.rb +0 -122
  392. data/spec/cucumber/ast/doc_string_spec.rb +0 -40
  393. data/spec/cucumber/ast/feature_factory.rb +0 -72
  394. data/spec/cucumber/ast/feature_spec.rb +0 -63
  395. data/spec/cucumber/ast/features_spec.rb +0 -51
  396. data/spec/cucumber/ast/outline_table_spec.rb +0 -21
  397. data/spec/cucumber/ast/scenario_outline_spec.rb +0 -74
  398. data/spec/cucumber/ast/step_spec.rb +0 -68
  399. data/spec/cucumber/ast/table_spec.rb +0 -594
  400. data/spec/cucumber/ast/tree_walker_spec.rb +0 -19
  401. data/spec/cucumber/broadcaster_spec.rb +0 -15
  402. data/spec/cucumber/cli/drb_client_spec.rb +0 -76
  403. data/spec/cucumber/rake/rcov_spec.rb +0 -71
  404. data/spec/cucumber/wire_support/wire_step_definition_spec.rb +0 -20
@@ -7,17 +7,18 @@ module Cucumber
7
7
  def transform(regexp)
8
8
  RbTransform.new(nil, regexp, lambda { |a| })
9
9
  end
10
+
10
11
  describe "#to_s" do
11
12
  it "converts captures groups to non-capture groups" do
12
- transform(/(a|b)bc/).to_s.should == "(?:a|b)bc"
13
+ expect(transform(/(a|b)bc/).to_s).to eq "(?:a|b)bc"
13
14
  end
14
15
 
15
16
  it "leaves non capture groups alone" do
16
- transform(/(?:a|b)bc/).to_s.should == "(?:a|b)bc"
17
+ expect(transform(/(?:a|b)bc/).to_s).to eq "(?:a|b)bc"
17
18
  end
18
19
 
19
20
  it "strips away anchors" do
20
- transform(/^xyz$/).to_s.should == "xyz"
21
+ expect(transform(/^xyz$/).to_s).to eq "xyz"
21
22
  end
22
23
  end
23
24
  end
@@ -6,14 +6,16 @@ module Cucumber
6
6
  describe RegexpArgumentMatcher do
7
7
  include RSpec::WorkInProgress
8
8
 
9
- it "should create 2 arguments" do
9
+ it "creates 2 arguments" do
10
10
  arguments = RegexpArgumentMatcher.arguments_from(/I (\w+) (\w+)/, "I like fish")
11
- arguments.map{|argument| [argument.val, argument.offset]}.should == [["like", 2], ["fish", 7]]
11
+
12
+ expect(arguments.map{|argument| [argument.val, argument.offset]}).to eq [["like", 2], ["fish", 7]]
12
13
  end
13
14
 
14
- it "should create 2 arguments when first group is optional" do
15
+ it "creates 2 arguments when first group is optional" do
15
16
  arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
16
- arguments.map{|argument| [argument.val, argument.offset]}.should == [[nil, nil], ["Login failed.", 21]]
17
+
18
+ expect(arguments.map{|argument| [argument.val, argument.offset]}).to eq [[nil, nil], ["Login failed.", 21]]
17
19
  end
18
20
  end
19
21
  end
@@ -4,16 +4,15 @@ require 'cucumber/rb_support/snippet'
4
4
  module Cucumber
5
5
  module RbSupport
6
6
  describe Snippet do
7
-
8
7
  let(:code_keyword) { "Given" }
9
8
 
10
9
  before do
11
10
  @pattern = 'we have a missing step'
12
- @multiline_argument_class = nil
11
+ @multiline_argument = Core::Ast::EmptyMultilineArgument.new
13
12
  end
14
13
 
15
14
  let(:snippet) do
16
- snippet_class.new(code_keyword, @pattern, @multiline_argument_class)
15
+ snippet_class.new(code_keyword, @pattern, @multiline_argument)
17
16
  end
18
17
 
19
18
  def unindented(s)
@@ -24,76 +23,87 @@ module Cucumber
24
23
  let(:snippet_class) { Snippet::Regexp }
25
24
  let(:snippet_text) { snippet.to_s }
26
25
 
27
- it "should wrap snippet patterns in parentheses" do
26
+ it "wraps snippet patterns in parentheses" do
28
27
  @pattern = 'A "string" with 4 spaces'
29
28
 
30
- snippet_text.should == unindented(%{
29
+ expect(snippet_text).to eq unindented(%{
31
30
  Given(/^A "(.*?)" with (\\d+) spaces$/) do |arg1, arg2|
32
- pending # express the regexp above with the code you wish you had
31
+ pending # Write code here that turns the phrase above into concrete actions
33
32
  end
34
33
  })
35
34
  end
36
35
 
37
- it "should recognise numbers in name and make according regexp" do
36
+ it "recognises numbers in name and make according regexp" do
38
37
  @pattern = 'Cloud 9 yeah'
39
38
 
40
- snippet_text.should == unindented(%{
39
+ expect(snippet_text).to eq unindented(%{
41
40
  Given(/^Cloud (\\d+) yeah$/) do |arg1|
42
- pending # express the regexp above with the code you wish you had
41
+ pending # Write code here that turns the phrase above into concrete actions
43
42
  end
44
43
  })
45
44
  end
46
45
 
47
- it "should recognise a mix of ints, strings and why not a table too" do
46
+ it "recognises a mix of ints, strings and why not a table too" do
48
47
  @pattern = 'I have 9 "awesome" cukes in 37 "boxes"'
49
- @multiline_argument_class = Cucumber::Ast::Table
48
+ @multiline_argument = Core::Ast::DataTable.new([[]], Core::Ast::Location.new(''))
50
49
 
51
- snippet_text.should == unindented(%{
50
+ expect(snippet_text).to eq unindented(%{
52
51
  Given(/^I have (\\d+) "(.*?)" cukes in (\\d+) "(.*?)"$/) do |arg1, arg2, arg3, arg4, table|
53
- # table is a Cucumber::Ast::Table
54
- pending # express the regexp above with the code you wish you had
52
+ # table is a Cucumber::Core::Ast::DataTable
53
+ pending # Write code here that turns the phrase above into concrete actions
55
54
  end
56
55
  })
57
56
  end
58
57
 
59
- it "should recognise quotes in name and make according regexp" do
58
+ it "recognises quotes in name and make according regexp" do
60
59
  @pattern = 'A "first" arg'
61
60
 
62
- snippet_text.should == unindented(%{
61
+ expect(snippet_text).to eq unindented(%{
63
62
  Given(/^A "(.*?)" arg$/) do |arg1|
64
- pending # express the regexp above with the code you wish you had
63
+ pending # Write code here that turns the phrase above into concrete actions
65
64
  end
66
65
  })
67
66
  end
68
67
 
69
- it "should recognise several quoted words in name and make according regexp and args" do
68
+ it "recognises several quoted words in name and make according regexp and args" do
70
69
  @pattern = 'A "first" and "second" arg'
71
70
 
72
- snippet_text.should == unindented(%{
71
+ expect(snippet_text).to eq unindented(%{
73
72
  Given(/^A "(.*?)" and "(.*?)" arg$/) do |arg1, arg2|
74
- pending # express the regexp above with the code you wish you had
73
+ pending # Write code here that turns the phrase above into concrete actions
75
74
  end
76
75
  })
77
76
  end
78
77
 
79
- it "should not use quote group when there are no quotes" do
78
+ it "does not use quote group when there are no quotes" do
80
79
  @pattern = 'A first arg'
81
80
 
82
- snippet_text.should == unindented(%{
81
+ expect(snippet_text).to eq unindented(%{
83
82
  Given(/^A first arg$/) do
84
- pending # express the regexp above with the code you wish you had
83
+ pending # Write code here that turns the phrase above into concrete actions
85
84
  end
86
85
  })
87
86
  end
88
87
 
89
- it "should be helpful with tables" do
88
+ it "is helpful with tables" do
90
89
  @pattern = 'A "first" arg'
91
- @multiline_argument_class = Cucumber::Ast::Table
90
+ @multiline_argument = Core::Ast::DataTable.new([[]], Core::Ast::Location.new(""))
92
91
 
93
- snippet_text.should == unindented(%{
92
+ expect(snippet_text).to eq unindented(%{
94
93
  Given(/^A "(.*?)" arg$/) do |arg1, table|
95
- # table is a Cucumber::Ast::Table
96
- pending # express the regexp above with the code you wish you had
94
+ # table is a Cucumber::Core::Ast::DataTable
95
+ pending # Write code here that turns the phrase above into concrete actions
96
+ end
97
+ })
98
+ end
99
+
100
+ it "is helpful with doc string" do
101
+ @pattern = 'A "first" arg'
102
+ @multiline_argument = Core::Ast::MultilineArgument.from("", Core::Ast::Location.new(""))
103
+
104
+ expect(snippet_text).to eq unindented(%{
105
+ Given(/^A "(.*?)" arg$/) do |arg1, string|
106
+ pending # Write code here that turns the phrase above into concrete actions
97
107
  end
98
108
  })
99
109
  end
@@ -103,9 +113,9 @@ module Cucumber
103
113
  let(:snippet_class) { Snippet::Classic }
104
114
 
105
115
  it "renders snippet as unwrapped regular expression" do
106
- snippet.to_s.should eql unindented(%{
116
+ expect(snippet.to_s).to eq unindented(%{
107
117
  Given /^we have a missing step$/ do
108
- pending # express the regexp above with the code you wish you had
118
+ pending # Write code here that turns the phrase above into concrete actions
109
119
  end
110
120
  })
111
121
  end
@@ -115,14 +125,13 @@ module Cucumber
115
125
  let(:snippet_class) { Snippet::Percent }
116
126
 
117
127
  it "renders snippet as percent-style regular expression" do
118
- snippet.to_s.should eql unindented(%{
128
+ expect(snippet.to_s).to eq unindented(%{
119
129
  Given %r{^we have a missing step$} do
120
- pending # express the regexp above with the code you wish you had
130
+ pending # Write code here that turns the phrase above into concrete actions
121
131
  end
122
132
  })
123
133
  end
124
134
  end
125
-
126
135
  end
127
136
  end
128
137
  end
@@ -0,0 +1,1750 @@
1
+ require 'cucumber/reports/legacy_formatter'
2
+ require 'cucumber/core'
3
+ require 'cucumber/core/gherkin/writer'
4
+ require 'cucumber/mappings'
5
+
6
+ module Cucumber
7
+ describe Reports::LegacyFormatter do
8
+ include Core::Gherkin::Writer
9
+ include Core
10
+
11
+ let(:report) { Reports::LegacyFormatter.new(runtime, [formatter]) }
12
+ let(:formatter) { double('formatter').as_null_object }
13
+ let(:runtime) { Runtime.new }
14
+ let(:mappings) { Mappings.new(runtime) }
15
+
16
+ before(:each) do
17
+ define_steps do
18
+ Given(/pass/) { }
19
+ Given(/fail/) { raise Failure }
20
+ end
21
+ end
22
+ Failure = Class.new(StandardError)
23
+
24
+ context 'message order' do
25
+ let(:formatter) { MessageSpy.new }
26
+
27
+ it 'two features' do
28
+ gherkin_docs = [
29
+ gherkin do
30
+ feature do
31
+ scenario do
32
+ step 'passing'
33
+ end
34
+ end
35
+ end,
36
+ gherkin do
37
+ feature do
38
+ scenario do
39
+ step 'passing'
40
+ end
41
+ end
42
+ end,
43
+ ]
44
+ execute gherkin_docs, mappings, report
45
+ expect( formatter.messages ).to eq [
46
+ :before_features,
47
+ :before_feature,
48
+ :before_tags,
49
+ :after_tags,
50
+ :feature_name,
51
+ :before_feature_element,
52
+ :before_tags,
53
+ :after_tags,
54
+ :scenario_name,
55
+ :before_steps,
56
+ :before_step,
57
+ :before_step_result,
58
+ :step_name,
59
+ :after_step_result,
60
+ :after_step,
61
+ :after_steps,
62
+ :after_feature_element,
63
+ :after_feature,
64
+ :before_feature,
65
+ :before_tags,
66
+ :after_tags,
67
+ :feature_name,
68
+ :before_feature_element,
69
+ :before_tags,
70
+ :after_tags,
71
+ :scenario_name,
72
+ :before_steps,
73
+ :before_step,
74
+ :before_step_result,
75
+ :step_name,
76
+ :after_step_result,
77
+ :after_step,
78
+ :after_steps,
79
+ :after_feature_element,
80
+ :after_feature,
81
+ :after_features
82
+ ]
83
+ end
84
+
85
+ it 'a scenario with no steps' do
86
+ execute_gherkin do
87
+ feature do
88
+ scenario
89
+ end
90
+ end
91
+ expect( formatter.messages ).to eq [
92
+ :before_features,
93
+ :before_feature,
94
+ :before_tags,
95
+ :after_tags,
96
+ :feature_name,
97
+ :before_feature_element,
98
+ :before_tags,
99
+ :after_tags,
100
+ :scenario_name,
101
+ :after_feature_element,
102
+ :after_feature,
103
+ :after_features
104
+ ]
105
+ end
106
+
107
+ it 'a scenario with no steps coming after another scenario' do
108
+ execute_gherkin do
109
+ feature do
110
+ scenario do
111
+ step 'passing'
112
+ end
113
+ scenario
114
+ end
115
+ end
116
+ expect( formatter.messages ).to eq [
117
+ :before_features,
118
+ :before_feature,
119
+ :before_tags,
120
+ :after_tags,
121
+ :feature_name,
122
+ :before_feature_element,
123
+ :before_tags,
124
+ :after_tags,
125
+ :scenario_name,
126
+ :before_steps,
127
+ :before_step,
128
+ :before_step_result,
129
+ :step_name,
130
+ :after_step_result,
131
+ :after_step,
132
+ :after_steps,
133
+ :after_feature_element,
134
+ :before_feature_element,
135
+ :before_tags,
136
+ :after_tags,
137
+ :scenario_name,
138
+ :after_feature_element,
139
+ :after_feature,
140
+ :after_features
141
+ ]
142
+ end
143
+
144
+ it 'a scenario with one step' do
145
+ execute_gherkin do
146
+ feature do
147
+ scenario do
148
+ step 'passing'
149
+ end
150
+ end
151
+ end
152
+ expect( formatter.messages ).to eq [
153
+ :before_features,
154
+ :before_feature,
155
+ :before_tags,
156
+ :after_tags,
157
+ :feature_name,
158
+ :before_feature_element,
159
+ :before_tags,
160
+ :after_tags,
161
+ :scenario_name,
162
+ :before_steps,
163
+ :before_step,
164
+ :before_step_result,
165
+ :step_name,
166
+ :after_step_result,
167
+ :after_step,
168
+ :after_steps,
169
+ :after_feature_element,
170
+ :after_feature,
171
+ :after_features
172
+ ]
173
+ end
174
+
175
+ it 'a scenario with two steps, one of them failing' do
176
+ execute_gherkin do
177
+ feature do
178
+ scenario do
179
+ step 'passing'
180
+ step 'failing'
181
+ end
182
+ end
183
+ end
184
+ expect( formatter.messages ).to eq [
185
+ :before_features,
186
+ :before_feature,
187
+ :before_tags,
188
+ :after_tags,
189
+ :feature_name,
190
+ :before_feature_element,
191
+ :before_tags,
192
+ :after_tags,
193
+ :scenario_name,
194
+ :before_steps,
195
+ :before_step,
196
+ :before_step_result,
197
+ :step_name,
198
+ :after_step_result,
199
+ :after_step,
200
+ :before_step,
201
+ :before_step_result,
202
+ :step_name,
203
+ :exception,
204
+ :after_step_result,
205
+ :after_step,
206
+ :after_steps,
207
+ :after_feature_element,
208
+ :after_feature,
209
+ :after_features
210
+ ]
211
+ end
212
+
213
+ it 'a feature with two scenarios' do
214
+ execute_gherkin do
215
+ feature do
216
+ scenario do
217
+ step 'passing'
218
+ end
219
+ scenario do
220
+ step 'passing'
221
+ end
222
+ end
223
+ end
224
+ expect( formatter.messages ).to eq [
225
+ :before_features,
226
+ :before_feature,
227
+ :before_tags,
228
+ :after_tags,
229
+ :feature_name,
230
+ :before_feature_element,
231
+ :before_tags,
232
+ :after_tags,
233
+ :scenario_name,
234
+ :before_steps,
235
+ :before_step,
236
+ :before_step_result,
237
+ :step_name,
238
+ :after_step_result,
239
+ :after_step,
240
+ :after_steps,
241
+ :after_feature_element,
242
+ :before_feature_element,
243
+ :before_tags,
244
+ :after_tags,
245
+ :scenario_name,
246
+ :before_steps,
247
+ :before_step,
248
+ :before_step_result,
249
+ :step_name,
250
+ :after_step_result,
251
+ :after_step,
252
+ :after_steps,
253
+ :after_feature_element,
254
+ :after_feature,
255
+ :after_features
256
+ ]
257
+ end
258
+
259
+ it 'a feature with a background and two scenarios' do
260
+ execute_gherkin do
261
+ feature do
262
+ background do
263
+ step 'passing'
264
+ end
265
+ scenario do
266
+ step 'passing'
267
+ end
268
+ scenario do
269
+ step 'passing'
270
+ end
271
+ end
272
+ end
273
+ expect( formatter.messages ).to eq [
274
+ :before_features,
275
+ :before_feature,
276
+ :before_tags,
277
+ :after_tags,
278
+ :feature_name,
279
+ :before_background,
280
+ :background_name,
281
+ :before_steps,
282
+ :before_step,
283
+ :before_step_result,
284
+ :step_name,
285
+ :after_step_result,
286
+ :after_step,
287
+ :after_steps,
288
+ :after_background,
289
+ :before_feature_element,
290
+ :before_tags,
291
+ :after_tags,
292
+ :scenario_name,
293
+ :before_steps,
294
+ :before_step,
295
+ :before_step_result,
296
+ :step_name,
297
+ :after_step_result,
298
+ :after_step,
299
+ :after_steps,
300
+ :after_feature_element,
301
+ :before_feature_element,
302
+ :before_tags,
303
+ :after_tags,
304
+ :scenario_name,
305
+ :before_steps,
306
+ :before_step,
307
+ :before_step_result,
308
+ :step_name,
309
+ :after_step_result,
310
+ :after_step,
311
+ :after_steps,
312
+ :after_feature_element,
313
+ :after_feature,
314
+ :after_features
315
+ ]
316
+ end
317
+
318
+ it 'a feature with a background and one scenario and one scenario outline' do
319
+ execute_gherkin do
320
+ feature do
321
+ background do
322
+ step 'passing'
323
+ end
324
+ scenario do
325
+ step 'passing'
326
+ end
327
+ scenario_outline do
328
+ step '<result>ing'
329
+ examples do
330
+ row 'result'
331
+ row 'pass'
332
+ end
333
+ end
334
+ end
335
+ end
336
+ expect( formatter.messages ).to eq [
337
+ :before_features,
338
+ :before_feature,
339
+ :before_tags,
340
+ :after_tags,
341
+ :feature_name,
342
+ :before_background,
343
+ :background_name,
344
+ :before_steps,
345
+ :before_step,
346
+ :before_step_result,
347
+ :step_name,
348
+ :after_step_result,
349
+ :after_step,
350
+ :after_steps,
351
+ :after_background,
352
+ :before_feature_element,
353
+ :before_tags,
354
+ :after_tags,
355
+ :scenario_name,
356
+ :before_steps,
357
+ :before_step,
358
+ :before_step_result,
359
+ :step_name,
360
+ :after_step_result,
361
+ :after_step,
362
+ :after_steps,
363
+ :after_feature_element,
364
+ :before_feature_element,
365
+ :before_tags,
366
+ :after_tags,
367
+ :scenario_name,
368
+ :before_steps,
369
+ :before_step,
370
+ :before_step_result,
371
+ :step_name,
372
+ :after_step_result,
373
+ :after_step,
374
+ :after_steps,
375
+ :before_examples_array,
376
+ :before_examples,
377
+ :examples_name,
378
+ :before_outline_table,
379
+ :before_table_row,
380
+ :before_table_cell,
381
+ :table_cell_value,
382
+ :after_table_cell,
383
+ :after_table_row,
384
+ :before_table_row,
385
+ :before_table_cell,
386
+ :table_cell_value,
387
+ :after_table_cell,
388
+ :after_table_row,
389
+ :after_outline_table,
390
+ :after_examples,
391
+ :after_examples_array,
392
+ :after_feature_element,
393
+ :after_feature,
394
+ :after_features
395
+ ]
396
+ end
397
+
398
+ it 'a feature with a background and one scenario outline and one scenario' do
399
+ execute_gherkin do
400
+ feature do
401
+ background do
402
+ step 'passing'
403
+ end
404
+ scenario_outline do
405
+ step '<result>ing'
406
+ examples do
407
+ row 'result'
408
+ row 'pass'
409
+ end
410
+ end
411
+ scenario do
412
+ step 'passing'
413
+ end
414
+ end
415
+ end
416
+ expect( formatter.messages ).to eq [
417
+ :before_features,
418
+ :before_feature,
419
+ :before_tags,
420
+ :after_tags,
421
+ :feature_name,
422
+ :before_background,
423
+ :background_name,
424
+ :before_steps,
425
+ :before_step,
426
+ :before_step_result,
427
+ :step_name,
428
+ :after_step_result,
429
+ :after_step,
430
+ :after_steps,
431
+ :after_background,
432
+ :before_feature_element,
433
+ :before_tags,
434
+ :after_tags,
435
+ :scenario_name,
436
+ :before_steps,
437
+ :before_step,
438
+ :before_step_result,
439
+ :step_name,
440
+ :after_step_result,
441
+ :after_step,
442
+ :after_steps,
443
+ :before_examples_array,
444
+ :before_examples,
445
+ :examples_name,
446
+ :before_outline_table,
447
+ :before_table_row,
448
+ :before_table_cell,
449
+ :table_cell_value,
450
+ :after_table_cell,
451
+ :after_table_row,
452
+ :before_table_row,
453
+ :before_table_cell,
454
+ :table_cell_value,
455
+ :after_table_cell,
456
+ :after_table_row,
457
+ :after_outline_table,
458
+ :after_examples,
459
+ :after_examples_array,
460
+ :after_feature_element,
461
+ :before_feature_element,
462
+ :before_tags,
463
+ :after_tags,
464
+ :scenario_name,
465
+ :before_steps,
466
+ :before_step,
467
+ :before_step_result,
468
+ :step_name,
469
+ :after_step_result,
470
+ :after_step,
471
+ :after_steps,
472
+ :after_feature_element,
473
+ :after_feature,
474
+ :after_features
475
+ ]
476
+ end
477
+
478
+ it 'a feature with a background and two scenario outlines' do
479
+ execute_gherkin do
480
+ feature do
481
+ background do
482
+ step 'passing'
483
+ end
484
+ scenario_outline do
485
+ step '<result>ing'
486
+ examples do
487
+ row 'result'
488
+ row 'pass'
489
+ end
490
+ end
491
+ scenario_outline do
492
+ step '<result>ing'
493
+ examples do
494
+ row 'result'
495
+ row 'pass'
496
+ end
497
+ end
498
+ end
499
+ end
500
+ expect( formatter.messages ).to eq [
501
+ :before_features,
502
+ :before_feature,
503
+ :before_tags,
504
+ :after_tags,
505
+ :feature_name,
506
+ :before_background,
507
+ :background_name,
508
+ :before_steps,
509
+ :before_step,
510
+ :before_step_result,
511
+ :step_name,
512
+ :after_step_result,
513
+ :after_step,
514
+ :after_steps,
515
+ :after_background,
516
+ :before_feature_element,
517
+ :before_tags,
518
+ :after_tags,
519
+ :scenario_name,
520
+ :before_steps,
521
+ :before_step,
522
+ :before_step_result,
523
+ :step_name,
524
+ :after_step_result,
525
+ :after_step,
526
+ :after_steps,
527
+ :before_examples_array,
528
+ :before_examples,
529
+ :examples_name,
530
+ :before_outline_table,
531
+ :before_table_row,
532
+ :before_table_cell,
533
+ :table_cell_value,
534
+ :after_table_cell,
535
+ :after_table_row,
536
+ :before_table_row,
537
+ :before_table_cell,
538
+ :table_cell_value,
539
+ :after_table_cell,
540
+ :after_table_row,
541
+ :after_outline_table,
542
+ :after_examples,
543
+ :after_examples_array,
544
+ :after_feature_element,
545
+ :before_feature_element,
546
+ :before_tags,
547
+ :after_tags,
548
+ :scenario_name,
549
+ :before_steps,
550
+ :before_step,
551
+ :before_step_result,
552
+ :step_name,
553
+ :after_step_result,
554
+ :after_step,
555
+ :after_steps,
556
+ :before_examples_array,
557
+ :before_examples,
558
+ :examples_name,
559
+ :before_outline_table,
560
+ :before_table_row,
561
+ :before_table_cell,
562
+ :table_cell_value,
563
+ :after_table_cell,
564
+ :after_table_row,
565
+ :before_table_row,
566
+ :before_table_cell,
567
+ :table_cell_value,
568
+ :after_table_cell,
569
+ :after_table_row,
570
+ :after_outline_table,
571
+ :after_examples,
572
+ :after_examples_array,
573
+ :after_feature_element,
574
+ :after_feature,
575
+ :after_features
576
+ ]
577
+ end
578
+
579
+ it 'a feature with a background and one scenario outline with two rows' do
580
+ execute_gherkin do
581
+ feature do
582
+ background do
583
+ step 'passing'
584
+ end
585
+ scenario_outline do
586
+ step '<result>ing'
587
+ examples do
588
+ row 'result'
589
+ row 'pass'
590
+ row 'pass'
591
+ end
592
+ end
593
+ end
594
+ end
595
+ expect( formatter.messages ).to eq [
596
+ :before_features,
597
+ :before_feature,
598
+ :before_tags,
599
+ :after_tags,
600
+ :feature_name,
601
+ :before_background,
602
+ :background_name,
603
+ :before_steps,
604
+ :before_step,
605
+ :before_step_result,
606
+ :step_name,
607
+ :after_step_result,
608
+ :after_step,
609
+ :after_steps,
610
+ :after_background,
611
+ :before_feature_element,
612
+ :before_tags,
613
+ :after_tags,
614
+ :scenario_name,
615
+ :before_steps,
616
+ :before_step,
617
+ :before_step_result,
618
+ :step_name,
619
+ :after_step_result,
620
+ :after_step,
621
+ :after_steps,
622
+ :before_examples_array,
623
+ :before_examples,
624
+ :examples_name,
625
+ :before_outline_table,
626
+ :before_table_row,
627
+ :before_table_cell,
628
+ :table_cell_value,
629
+ :after_table_cell,
630
+ :after_table_row,
631
+ :before_table_row,
632
+ :before_table_cell,
633
+ :table_cell_value,
634
+ :after_table_cell,
635
+ :after_table_row,
636
+ :before_table_row,
637
+ :before_table_cell,
638
+ :table_cell_value,
639
+ :after_table_cell,
640
+ :after_table_row,
641
+ :after_outline_table,
642
+ :after_examples,
643
+ :after_examples_array,
644
+ :after_feature_element,
645
+ :after_feature,
646
+ :after_features
647
+ ]
648
+ end
649
+
650
+ it 'a feature with a background and one scenario outline with two examples tables' do
651
+ execute_gherkin do
652
+ feature do
653
+ background do
654
+ step 'passing'
655
+ end
656
+ scenario_outline do
657
+ step '<result>ing'
658
+ examples do
659
+ row 'result'
660
+ row 'pass'
661
+ end
662
+ examples do
663
+ row 'result'
664
+ row 'pass'
665
+ end
666
+ end
667
+ end
668
+ end
669
+ expect( formatter.messages ).to eq [
670
+ :before_features,
671
+ :before_feature,
672
+ :before_tags,
673
+ :after_tags,
674
+ :feature_name,
675
+ :before_background,
676
+ :background_name,
677
+ :before_steps,
678
+ :before_step,
679
+ :before_step_result,
680
+ :step_name,
681
+ :after_step_result,
682
+ :after_step,
683
+ :after_steps,
684
+ :after_background,
685
+ :before_feature_element,
686
+ :before_tags,
687
+ :after_tags,
688
+ :scenario_name,
689
+ :before_steps,
690
+ :before_step,
691
+ :before_step_result,
692
+ :step_name,
693
+ :after_step_result,
694
+ :after_step,
695
+ :after_steps,
696
+ :before_examples_array,
697
+ :before_examples,
698
+ :examples_name,
699
+ :before_outline_table,
700
+ :before_table_row,
701
+ :before_table_cell,
702
+ :table_cell_value,
703
+ :after_table_cell,
704
+ :after_table_row,
705
+ :before_table_row,
706
+ :before_table_cell,
707
+ :table_cell_value,
708
+ :after_table_cell,
709
+ :after_table_row,
710
+ :after_outline_table,
711
+ :after_examples,
712
+ :before_examples,
713
+ :examples_name,
714
+ :before_outline_table,
715
+ :before_table_row,
716
+ :before_table_cell,
717
+ :table_cell_value,
718
+ :after_table_cell,
719
+ :after_table_row,
720
+ :before_table_row,
721
+ :before_table_cell,
722
+ :table_cell_value,
723
+ :after_table_cell,
724
+ :after_table_row,
725
+ :after_outline_table,
726
+ :after_examples,
727
+ :after_examples_array,
728
+ :after_feature_element,
729
+ :after_feature,
730
+ :after_features
731
+ ]
732
+ end
733
+
734
+ it 'a feature with a background with two steps' do
735
+ execute_gherkin do
736
+ feature do
737
+ background do
738
+ step 'passing'
739
+ step 'passing'
740
+ end
741
+ scenario do
742
+ step 'passing'
743
+ end
744
+ end
745
+ end
746
+ expect( formatter.messages ).to eq [
747
+ :before_features,
748
+ :before_feature,
749
+ :before_tags,
750
+ :after_tags,
751
+ :feature_name,
752
+ :before_background,
753
+ :background_name,
754
+ :before_steps,
755
+ :before_step,
756
+ :before_step_result,
757
+ :step_name,
758
+ :after_step_result,
759
+ :after_step,
760
+ :before_step,
761
+ :before_step_result,
762
+ :step_name,
763
+ :after_step_result,
764
+ :after_step,
765
+ :after_steps,
766
+ :after_background,
767
+ :before_feature_element,
768
+ :before_tags,
769
+ :after_tags,
770
+ :scenario_name,
771
+ :before_steps,
772
+ :before_step,
773
+ :before_step_result,
774
+ :step_name,
775
+ :after_step_result,
776
+ :after_step,
777
+ :after_steps,
778
+ :after_feature_element,
779
+ :after_feature,
780
+ :after_features
781
+ ]
782
+ end
783
+
784
+ it 'a feature with a background' do
785
+ execute_gherkin do
786
+ feature do
787
+ background do
788
+ step 'passing'
789
+ end
790
+ scenario do
791
+ step 'passing'
792
+ end
793
+ end
794
+ end
795
+ expect( formatter.messages ).to eq [
796
+ :before_features,
797
+ :before_feature,
798
+ :before_tags,
799
+ :after_tags,
800
+ :feature_name,
801
+ :before_background,
802
+ :background_name,
803
+ :before_steps,
804
+ :before_step,
805
+ :before_step_result,
806
+ :step_name,
807
+ :after_step_result,
808
+ :after_step,
809
+ :after_steps,
810
+ :after_background,
811
+ :before_feature_element,
812
+ :before_tags,
813
+ :after_tags,
814
+ :scenario_name,
815
+ :before_steps,
816
+ :before_step,
817
+ :before_step_result,
818
+ :step_name,
819
+ :after_step_result,
820
+ :after_step,
821
+ :after_steps,
822
+ :after_feature_element,
823
+ :after_feature,
824
+ :after_features
825
+ ]
826
+ end
827
+
828
+ it 'scenario outline' do
829
+ execute_gherkin do
830
+ feature do
831
+ scenario_outline do
832
+ step '<result>ing'
833
+ examples do
834
+ row 'result'
835
+ row 'pass'
836
+ end
837
+ end
838
+ end
839
+ end
840
+ expect( formatter.messages ).to eq [
841
+ :before_features,
842
+ :before_feature,
843
+ :before_tags,
844
+ :after_tags,
845
+ :feature_name,
846
+ :before_feature_element,
847
+ :before_tags,
848
+ :after_tags,
849
+ :scenario_name,
850
+ :before_steps,
851
+ :before_step,
852
+ :before_step_result,
853
+ :step_name,
854
+ :after_step_result,
855
+ :after_step,
856
+ :after_steps,
857
+ :before_examples_array,
858
+ :before_examples,
859
+ :examples_name,
860
+ :before_outline_table,
861
+ :before_table_row,
862
+ :before_table_cell,
863
+ :table_cell_value,
864
+ :after_table_cell,
865
+ :after_table_row,
866
+ :before_table_row,
867
+ :before_table_cell,
868
+ :table_cell_value,
869
+ :after_table_cell,
870
+ :after_table_row,
871
+ :after_outline_table,
872
+ :after_examples,
873
+ :after_examples_array,
874
+ :after_feature_element,
875
+ :after_feature,
876
+ :after_features
877
+ ]
878
+ end
879
+
880
+ it 'scenario outline after scenario' do
881
+ execute_gherkin do
882
+ feature do
883
+ scenario do
884
+ step 'passing'
885
+ end
886
+ scenario_outline do
887
+ step '<result>ing'
888
+ examples do
889
+ row 'result'
890
+ row 'pass'
891
+ end
892
+ end
893
+ end
894
+ end
895
+ expect( formatter.messages ).to eq [
896
+ :before_features,
897
+ :before_feature,
898
+ :before_tags,
899
+ :after_tags,
900
+ :feature_name,
901
+ :before_feature_element,
902
+ :before_tags,
903
+ :after_tags,
904
+ :scenario_name,
905
+ :before_steps,
906
+ :before_step,
907
+ :before_step_result,
908
+ :step_name,
909
+ :after_step_result,
910
+ :after_step,
911
+ :after_steps,
912
+ :after_feature_element,
913
+ :before_feature_element,
914
+ :before_tags,
915
+ :after_tags,
916
+ :scenario_name,
917
+ :before_steps,
918
+ :before_step,
919
+ :before_step_result,
920
+ :step_name,
921
+ :after_step_result,
922
+ :after_step,
923
+ :after_steps,
924
+ :before_examples_array,
925
+ :before_examples,
926
+ :examples_name,
927
+ :before_outline_table,
928
+ :before_table_row,
929
+ :before_table_cell,
930
+ :table_cell_value,
931
+ :after_table_cell,
932
+ :after_table_row,
933
+ :before_table_row,
934
+ :before_table_cell,
935
+ :table_cell_value,
936
+ :after_table_cell,
937
+ :after_table_row,
938
+ :after_outline_table,
939
+ :after_examples,
940
+ :after_examples_array,
941
+ :after_feature_element,
942
+ :after_feature,
943
+ :after_features
944
+ ]
945
+ end
946
+
947
+ it 'scenario outline before scenario' do
948
+ execute_gherkin do
949
+ feature do
950
+ scenario_outline do
951
+ step '<result>ing'
952
+ examples do
953
+ row 'result'
954
+ row 'pass'
955
+ end
956
+ end
957
+ scenario do
958
+ step 'passing'
959
+ end
960
+ end
961
+ end
962
+ expect( formatter.messages ).to eq [
963
+ :before_features,
964
+ :before_feature,
965
+ :before_tags,
966
+ :after_tags,
967
+ :feature_name,
968
+ :before_feature_element,
969
+ :before_tags,
970
+ :after_tags,
971
+ :scenario_name,
972
+ :before_steps,
973
+ :before_step,
974
+ :before_step_result,
975
+ :step_name,
976
+ :after_step_result,
977
+ :after_step,
978
+ :after_steps,
979
+ :before_examples_array,
980
+ :before_examples,
981
+ :examples_name,
982
+ :before_outline_table,
983
+ :before_table_row,
984
+ :before_table_cell,
985
+ :table_cell_value,
986
+ :after_table_cell,
987
+ :after_table_row,
988
+ :before_table_row,
989
+ :before_table_cell,
990
+ :table_cell_value,
991
+ :after_table_cell,
992
+ :after_table_row,
993
+ :after_outline_table,
994
+ :after_examples,
995
+ :after_examples_array,
996
+ :after_feature_element,
997
+ :before_feature_element,
998
+ :before_tags,
999
+ :after_tags,
1000
+ :scenario_name,
1001
+ :before_steps,
1002
+ :before_step,
1003
+ :before_step_result,
1004
+ :step_name,
1005
+ :after_step_result,
1006
+ :after_step,
1007
+ :after_steps,
1008
+ :after_feature_element,
1009
+ :after_feature,
1010
+ :after_features
1011
+ ]
1012
+ end
1013
+
1014
+ it 'scenario outline two rows' do
1015
+ execute_gherkin do
1016
+ feature do
1017
+ scenario_outline do
1018
+ step '<result>ing'
1019
+ examples do
1020
+ row 'result'
1021
+ row 'pass'
1022
+ row 'pass'
1023
+ end
1024
+ end
1025
+ end
1026
+ end
1027
+ expect( formatter.messages ).to eq [
1028
+ :before_features,
1029
+ :before_feature,
1030
+ :before_tags,
1031
+ :after_tags,
1032
+ :feature_name,
1033
+ :before_feature_element,
1034
+ :before_tags,
1035
+ :after_tags,
1036
+ :scenario_name,
1037
+ :before_steps,
1038
+ :before_step,
1039
+ :before_step_result,
1040
+ :step_name,
1041
+ :after_step_result,
1042
+ :after_step,
1043
+ :after_steps,
1044
+ :before_examples_array,
1045
+ :before_examples,
1046
+ :examples_name,
1047
+ :before_outline_table,
1048
+ :before_table_row,
1049
+ :before_table_cell,
1050
+ :table_cell_value,
1051
+ :after_table_cell,
1052
+ :after_table_row,
1053
+ :before_table_row,
1054
+ :before_table_cell,
1055
+ :table_cell_value,
1056
+ :after_table_cell,
1057
+ :after_table_row,
1058
+ :before_table_row,
1059
+ :before_table_cell,
1060
+ :table_cell_value,
1061
+ :after_table_cell,
1062
+ :after_table_row,
1063
+ :after_outline_table,
1064
+ :after_examples,
1065
+ :after_examples_array,
1066
+ :after_feature_element,
1067
+ :after_feature,
1068
+ :after_features
1069
+ ]
1070
+ end
1071
+
1072
+ it 'scenario outline two examples tables' do
1073
+ execute_gherkin do
1074
+ feature do
1075
+ scenario_outline do
1076
+ step '<result>ing'
1077
+ examples do
1078
+ row 'result'
1079
+ row 'pass'
1080
+ end
1081
+ examples do
1082
+ row 'result'
1083
+ row 'pass'
1084
+ end
1085
+ end
1086
+ end
1087
+ end
1088
+ expect( formatter.messages ).to eq [
1089
+ :before_features,
1090
+ :before_feature,
1091
+ :before_tags,
1092
+ :after_tags,
1093
+ :feature_name,
1094
+ :before_feature_element,
1095
+ :before_tags,
1096
+ :after_tags,
1097
+ :scenario_name,
1098
+ :before_steps,
1099
+ :before_step,
1100
+ :before_step_result,
1101
+ :step_name,
1102
+ :after_step_result,
1103
+ :after_step,
1104
+ :after_steps,
1105
+ :before_examples_array,
1106
+ :before_examples,
1107
+ :examples_name,
1108
+ :before_outline_table,
1109
+ :before_table_row,
1110
+ :before_table_cell,
1111
+ :table_cell_value,
1112
+ :after_table_cell,
1113
+ :after_table_row,
1114
+ :before_table_row,
1115
+ :before_table_cell,
1116
+ :table_cell_value,
1117
+ :after_table_cell,
1118
+ :after_table_row,
1119
+ :after_outline_table,
1120
+ :after_examples,
1121
+ :before_examples,
1122
+ :examples_name,
1123
+ :before_outline_table,
1124
+ :before_table_row,
1125
+ :before_table_cell,
1126
+ :table_cell_value,
1127
+ :after_table_cell,
1128
+ :after_table_row,
1129
+ :before_table_row,
1130
+ :before_table_cell,
1131
+ :table_cell_value,
1132
+ :after_table_cell,
1133
+ :after_table_row,
1134
+ :after_outline_table,
1135
+ :after_examples,
1136
+ :after_examples_array,
1137
+ :after_feature_element,
1138
+ :after_feature,
1139
+ :after_features
1140
+ ]
1141
+ end
1142
+
1143
+ it 'two scenario outline' do
1144
+ execute_gherkin do
1145
+ feature do
1146
+ scenario_outline do
1147
+ step '<result>ing'
1148
+ examples do
1149
+ row 'result'
1150
+ row 'pass'
1151
+ end
1152
+ end
1153
+ scenario_outline do
1154
+ step '<result>ing'
1155
+ examples do
1156
+ row 'result'
1157
+ row 'pass'
1158
+ end
1159
+ end
1160
+ end
1161
+ end
1162
+ expect( formatter.messages ).to eq [
1163
+ :before_features,
1164
+ :before_feature,
1165
+ :before_tags,
1166
+ :after_tags,
1167
+ :feature_name,
1168
+ :before_feature_element,
1169
+ :before_tags,
1170
+ :after_tags,
1171
+ :scenario_name,
1172
+ :before_steps,
1173
+ :before_step,
1174
+ :before_step_result,
1175
+ :step_name,
1176
+ :after_step_result,
1177
+ :after_step,
1178
+ :after_steps,
1179
+ :before_examples_array,
1180
+ :before_examples,
1181
+ :examples_name,
1182
+ :before_outline_table,
1183
+ :before_table_row,
1184
+ :before_table_cell,
1185
+ :table_cell_value,
1186
+ :after_table_cell,
1187
+ :after_table_row,
1188
+ :before_table_row,
1189
+ :before_table_cell,
1190
+ :table_cell_value,
1191
+ :after_table_cell,
1192
+ :after_table_row,
1193
+ :after_outline_table,
1194
+ :after_examples,
1195
+ :after_examples_array,
1196
+ :after_feature_element,
1197
+ :before_feature_element,
1198
+ :before_tags,
1199
+ :after_tags,
1200
+ :scenario_name,
1201
+ :before_steps,
1202
+ :before_step,
1203
+ :before_step_result,
1204
+ :step_name,
1205
+ :after_step_result,
1206
+ :after_step,
1207
+ :after_steps,
1208
+ :before_examples_array,
1209
+ :before_examples,
1210
+ :examples_name,
1211
+ :before_outline_table,
1212
+ :before_table_row,
1213
+ :before_table_cell,
1214
+ :table_cell_value,
1215
+ :after_table_cell,
1216
+ :after_table_row,
1217
+ :before_table_row,
1218
+ :before_table_cell,
1219
+ :table_cell_value,
1220
+ :after_table_cell,
1221
+ :after_table_row,
1222
+ :after_outline_table,
1223
+ :after_examples,
1224
+ :after_examples_array,
1225
+ :after_feature_element,
1226
+ :after_feature,
1227
+ :after_features
1228
+ ]
1229
+ end
1230
+
1231
+ it 'failing scenario outline' do
1232
+ execute_gherkin do
1233
+ feature do
1234
+ scenario_outline do
1235
+ step '<result>ing'
1236
+ examples do
1237
+ row 'result'
1238
+ row 'fail'
1239
+ end
1240
+ end
1241
+ end
1242
+ end
1243
+ expect( formatter.messages ).to eq [
1244
+ :before_features,
1245
+ :before_feature,
1246
+ :before_tags,
1247
+ :after_tags,
1248
+ :feature_name,
1249
+ :before_feature_element,
1250
+ :before_tags,
1251
+ :after_tags,
1252
+ :scenario_name,
1253
+ :before_steps,
1254
+ :before_step,
1255
+ :before_step_result,
1256
+ :step_name,
1257
+ :after_step_result,
1258
+ :after_step,
1259
+ :after_steps,
1260
+ :before_examples_array,
1261
+ :before_examples,
1262
+ :examples_name,
1263
+ :before_outline_table,
1264
+ :before_table_row,
1265
+ :before_table_cell,
1266
+ :table_cell_value,
1267
+ :after_table_cell,
1268
+ :after_table_row,
1269
+ :before_table_row,
1270
+ :before_table_cell,
1271
+ :table_cell_value,
1272
+ :after_table_cell,
1273
+ :after_table_row,
1274
+ :after_outline_table,
1275
+ :after_examples,
1276
+ :after_examples_array,
1277
+ :after_feature_element,
1278
+ :after_feature,
1279
+ :after_features
1280
+ ]
1281
+ end
1282
+
1283
+ it 'a feature with a failing background and two scenarios' do
1284
+ execute_gherkin do
1285
+ feature do
1286
+ background do
1287
+ step 'failing'
1288
+ end
1289
+ scenario do
1290
+ step 'passing'
1291
+ end
1292
+ scenario do
1293
+ step 'passing'
1294
+ end
1295
+ end
1296
+ end
1297
+ expect( formatter.messages ).to eq [
1298
+ :before_features,
1299
+ :before_feature,
1300
+ :before_tags,
1301
+ :after_tags,
1302
+ :feature_name,
1303
+ :before_background,
1304
+ :background_name,
1305
+ :before_steps,
1306
+ :before_step,
1307
+ :before_step_result,
1308
+ :step_name,
1309
+ :exception,
1310
+ :after_step_result,
1311
+ :after_step,
1312
+ :after_steps,
1313
+ :after_background,
1314
+ :before_feature_element,
1315
+ :before_tags,
1316
+ :after_tags,
1317
+ :scenario_name,
1318
+ :before_steps,
1319
+ :before_step,
1320
+ :before_step_result,
1321
+ :step_name,
1322
+ :after_step_result,
1323
+ :after_step,
1324
+ :after_steps,
1325
+ :after_feature_element,
1326
+ :before_feature_element,
1327
+ :before_tags,
1328
+ :after_tags,
1329
+ :scenario_name,
1330
+ :before_steps,
1331
+ :before_step,
1332
+ :before_step_result,
1333
+ :step_name,
1334
+ :after_step_result,
1335
+ :after_step,
1336
+ :after_steps,
1337
+ :after_feature_element,
1338
+ :after_feature,
1339
+ :after_features
1340
+ ]
1341
+ end
1342
+
1343
+ context 'in expand mode' do
1344
+ let(:runtime) { Runtime.new expand: true }
1345
+ let(:formatter) { MessageSpy.new }
1346
+
1347
+ it 'scenario outline two rows' do
1348
+ execute_gherkin do
1349
+ feature do
1350
+ scenario_outline do
1351
+ step '<result>ing'
1352
+ examples do
1353
+ row 'result'
1354
+ row 'pass'
1355
+ row 'pass'
1356
+ end
1357
+ end
1358
+ end
1359
+ end
1360
+ expect( formatter.messages ).to eq [
1361
+ :before_features,
1362
+ :before_feature,
1363
+ :before_tags,
1364
+ :after_tags,
1365
+ :feature_name,
1366
+ :before_feature_element,
1367
+ :before_tags,
1368
+ :after_tags,
1369
+ :scenario_name,
1370
+ :before_steps,
1371
+ :before_step,
1372
+ :before_step_result,
1373
+ :step_name,
1374
+ :after_step_result,
1375
+ :after_step,
1376
+ :after_steps,
1377
+ :before_examples_array,
1378
+ :before_examples,
1379
+ :examples_name,
1380
+ :before_outline_table,
1381
+ :scenario_name,
1382
+ :before_step,
1383
+ :before_step_result,
1384
+ :step_name,
1385
+ :after_step_result,
1386
+ :after_step,
1387
+ :scenario_name,
1388
+ :before_step,
1389
+ :before_step_result,
1390
+ :step_name,
1391
+ :after_step_result,
1392
+ :after_step,
1393
+ :after_outline_table,
1394
+ :after_examples,
1395
+ :after_examples_array,
1396
+ :after_feature_element,
1397
+ :after_feature,
1398
+ :after_features
1399
+ ]
1400
+ end
1401
+ end
1402
+
1403
+ context 'with exception in after step hook' do
1404
+ it 'prints the exception within the step' do
1405
+ define_steps do
1406
+ AfterStep do
1407
+ raise 'an exception'
1408
+ end
1409
+ end
1410
+ execute_gherkin do
1411
+ feature do
1412
+ scenario do
1413
+ step 'passing'
1414
+ end
1415
+ end
1416
+ end
1417
+ expect( formatter.messages ).to eq([
1418
+ :before_features,
1419
+ :before_feature,
1420
+ :before_tags,
1421
+ :after_tags,
1422
+ :feature_name,
1423
+ :before_feature_element,
1424
+ :before_tags,
1425
+ :after_tags,
1426
+ :scenario_name,
1427
+ :before_steps,
1428
+ :before_step,
1429
+ :before_step_result,
1430
+ :step_name,
1431
+ :after_step_result,
1432
+ :after_step,
1433
+ :exception,
1434
+ :after_steps,
1435
+ :after_feature_element,
1436
+ :after_feature,
1437
+ :after_features
1438
+ ])
1439
+ end
1440
+ end
1441
+
1442
+ context 'with exception in before hooks' do
1443
+ it 'prints the exception after the scenario name' do
1444
+ define_steps do
1445
+ Before do
1446
+ raise 'an exception'
1447
+ end
1448
+ end
1449
+ execute_gherkin do
1450
+ feature do
1451
+ scenario do
1452
+ step 'passing'
1453
+ end
1454
+ end
1455
+ end
1456
+
1457
+ expect( formatter.messages ).to eq([
1458
+ :before_features,
1459
+ :before_feature,
1460
+ :before_tags,
1461
+ :after_tags,
1462
+ :feature_name,
1463
+ :before_feature_element,
1464
+ :before_tags,
1465
+ :after_tags,
1466
+ :scenario_name,
1467
+ :exception,
1468
+ :before_steps,
1469
+ :before_step,
1470
+ :before_step_result,
1471
+ :step_name,
1472
+ :after_step_result,
1473
+ :after_step,
1474
+ :after_steps,
1475
+ :after_feature_element,
1476
+ :after_feature,
1477
+ :after_features
1478
+ ])
1479
+ end
1480
+
1481
+ it 'prints the exception after the background name' do
1482
+ define_steps do
1483
+ Before do
1484
+ raise 'an exception'
1485
+ end
1486
+ end
1487
+ execute_gherkin do
1488
+ feature do
1489
+ background do
1490
+ step 'passing'
1491
+ end
1492
+ scenario do
1493
+ step 'passing'
1494
+ end
1495
+ end
1496
+ end
1497
+
1498
+ expect( formatter.messages ).to eq([
1499
+ :before_features,
1500
+ :before_feature,
1501
+ :before_tags,
1502
+ :after_tags,
1503
+ :feature_name,
1504
+ :before_background,
1505
+ :background_name,
1506
+ :exception,
1507
+ :before_steps,
1508
+ :before_step,
1509
+ :before_step_result,
1510
+ :step_name,
1511
+ :after_step_result,
1512
+ :after_step,
1513
+ :after_steps,
1514
+ :after_background,
1515
+ :before_feature_element,
1516
+ :before_tags,
1517
+ :after_tags,
1518
+ :scenario_name,
1519
+ :before_steps,
1520
+ :before_step,
1521
+ :before_step_result,
1522
+ :step_name,
1523
+ :after_step_result,
1524
+ :after_step,
1525
+ :after_steps,
1526
+ :after_feature_element,
1527
+ :after_feature,
1528
+ :after_features
1529
+ ])
1530
+ end
1531
+
1532
+
1533
+ it 'prints the exception before the examples table row' do
1534
+ define_steps do
1535
+ Before do
1536
+ raise 'an exception'
1537
+ end
1538
+ end
1539
+ execute_gherkin do
1540
+ feature do
1541
+ scenario_outline do
1542
+ step '<status>ing'
1543
+ examples do
1544
+ row 'status'
1545
+ row 'pass'
1546
+ end
1547
+ end
1548
+ end
1549
+ end
1550
+
1551
+ expect( formatter.messages ).to eq([
1552
+ :before_features,
1553
+ :before_feature,
1554
+ :before_tags,
1555
+ :after_tags,
1556
+ :feature_name,
1557
+ :before_feature_element,
1558
+ :before_tags,
1559
+ :after_tags,
1560
+ :scenario_name,
1561
+ :before_steps,
1562
+ :before_step,
1563
+ :before_step_result,
1564
+ :step_name,
1565
+ :after_step_result,
1566
+ :after_step,
1567
+ :after_steps,
1568
+ :before_examples_array,
1569
+ :before_examples,
1570
+ :examples_name,
1571
+ :before_outline_table,
1572
+ :before_table_row,
1573
+ :before_table_cell,
1574
+ :table_cell_value,
1575
+ :after_table_cell,
1576
+ :after_table_row,
1577
+ :exception,
1578
+ :before_table_row,
1579
+ :before_table_cell,
1580
+ :table_cell_value,
1581
+ :after_table_cell,
1582
+ :after_table_row,
1583
+ :after_outline_table,
1584
+ :after_examples,
1585
+ :after_examples_array,
1586
+ :after_feature_element,
1587
+ :after_feature,
1588
+ :after_features
1589
+ ])
1590
+ end
1591
+ end
1592
+
1593
+ context 'with exception in after hooks' do
1594
+ it 'prints the exception after the steps' do
1595
+ define_steps do
1596
+ After do
1597
+ raise 'an exception'
1598
+ end
1599
+ end
1600
+ execute_gherkin do
1601
+ feature do
1602
+ scenario do
1603
+ step 'passing'
1604
+ end
1605
+ end
1606
+ end
1607
+
1608
+ expect( formatter.messages ).to eq([
1609
+ :before_features,
1610
+ :before_feature,
1611
+ :before_tags,
1612
+ :after_tags,
1613
+ :feature_name,
1614
+ :before_feature_element,
1615
+ :before_tags,
1616
+ :after_tags,
1617
+ :scenario_name,
1618
+ :before_steps,
1619
+ :before_step,
1620
+ :before_step_result,
1621
+ :step_name,
1622
+ :after_step_result,
1623
+ :after_step,
1624
+ :after_steps,
1625
+ :exception,
1626
+ :after_feature_element,
1627
+ :after_feature,
1628
+ :after_features
1629
+ ])
1630
+ end
1631
+
1632
+ it 'prints the exception after the examples table row' do
1633
+ define_steps do
1634
+ After do
1635
+ raise 'an exception'
1636
+ end
1637
+ end
1638
+ execute_gherkin do
1639
+ feature do
1640
+ scenario_outline do
1641
+ step '<status>ing'
1642
+ examples do
1643
+ row 'status'
1644
+ row 'pass'
1645
+ end
1646
+ end
1647
+ end
1648
+ end
1649
+
1650
+ expect( formatter.messages ).to eq([
1651
+ :before_features,
1652
+ :before_feature,
1653
+ :before_tags,
1654
+ :after_tags,
1655
+ :feature_name,
1656
+ :before_feature_element,
1657
+ :before_tags,
1658
+ :after_tags,
1659
+ :scenario_name,
1660
+ :before_steps,
1661
+ :before_step,
1662
+ :before_step_result,
1663
+ :step_name,
1664
+ :after_step_result,
1665
+ :after_step,
1666
+ :after_steps,
1667
+ :before_examples_array,
1668
+ :before_examples,
1669
+ :examples_name,
1670
+ :before_outline_table,
1671
+ :before_table_row,
1672
+ :before_table_cell,
1673
+ :table_cell_value,
1674
+ :after_table_cell,
1675
+ :after_table_row,
1676
+ :before_table_row,
1677
+ :before_table_cell,
1678
+ :table_cell_value,
1679
+ :after_table_cell,
1680
+ :after_table_row,
1681
+ :exception,
1682
+ :after_outline_table,
1683
+ :after_examples,
1684
+ :after_examples_array,
1685
+ :after_feature_element,
1686
+ :after_feature,
1687
+ :after_features
1688
+ ])
1689
+ end
1690
+ end
1691
+ end
1692
+
1693
+ it 'passes an object responding to failed? with the after_feature_element message' do
1694
+ expect( formatter ).to receive(:after_feature_element) do |scenario|
1695
+ expect( scenario ).to be_failed
1696
+ end
1697
+ execute_gherkin do
1698
+ feature do
1699
+ scenario do
1700
+ step 'failing'
1701
+ end
1702
+ end
1703
+ end
1704
+ end
1705
+
1706
+ context 'in strict mode' do
1707
+ let(:runtime) { Runtime.new strict: true }
1708
+
1709
+ it 'passes an exception to the formatter for undefined steps' do
1710
+ expect( formatter ).to receive(:exception) do |exception|
1711
+ expect( exception.message ).to eq %{Undefined step: "this step is undefined"}
1712
+ end
1713
+ execute_gherkin do
1714
+ feature do
1715
+ scenario do
1716
+ step 'this step is undefined'
1717
+ end
1718
+ end
1719
+ end
1720
+ end
1721
+ end
1722
+
1723
+ class MessageSpy
1724
+ attr_reader :messages
1725
+
1726
+ def initialize
1727
+ @messages = []
1728
+ end
1729
+
1730
+ def method_missing(message, *args)
1731
+ @messages << message
1732
+ end
1733
+
1734
+ def respond_to_missing?(name, include_private = false)
1735
+ true
1736
+ end
1737
+ end
1738
+
1739
+ def execute_gherkin(&gherkin)
1740
+ execute [gherkin(&gherkin)], mappings, report
1741
+ end
1742
+
1743
+ def define_steps(&block)
1744
+ runtime.load_programming_language('rb')
1745
+ dsl = Object.new
1746
+ dsl.extend RbSupport::RbDsl
1747
+ dsl.instance_exec &block
1748
+ end
1749
+ end
1750
+ end