mobiusloop 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (516) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.travis.yml +22 -0
  6. data/.yardopts +1 -0
  7. data/CONTRIBUTING.md +68 -0
  8. data/Gemfile +5 -0
  9. data/History.md +2280 -0
  10. data/LICENSE +22 -0
  11. data/README.md +373 -0
  12. data/Rakefile +22 -0
  13. data/bin/mobiusloop +8 -0
  14. data/cucumber.gemspec +47 -0
  15. data/cucumber.yml +20 -0
  16. data/examples/i18n/README.textile +3 -0
  17. data/examples/i18n/Rakefile +33 -0
  18. data/examples/i18n/ar/Rakefile +6 -0
  19. data/examples/i18n/ar/features/addition.feature +17 -0
  20. data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +24 -0
  21. data/examples/i18n/ar/lib/calculator.rb +11 -0
  22. data/examples/i18n/bg/Rakefile +6 -0
  23. data/examples/i18n/bg/features/addition.feature +12 -0
  24. data/examples/i18n/bg/features/consecutive_calculations.feature +19 -0
  25. data/examples/i18n/bg/features/division.feature +17 -0
  26. data/examples/i18n/bg/features/step_definitions/calculator_steps.rb +24 -0
  27. data/examples/i18n/bg/features/support/env.rb +5 -0
  28. data/examples/i18n/bg/features/support/world.rb +8 -0
  29. data/examples/i18n/bg/lib/calculator.rb +24 -0
  30. data/examples/i18n/ca/Rakefile +6 -0
  31. data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +21 -0
  32. data/examples/i18n/ca/features/suma.feature +17 -0
  33. data/examples/i18n/ca/lib/calculadora.rb +16 -0
  34. data/examples/i18n/cs/Rakefile +6 -0
  35. data/examples/i18n/cs/features/addition.feature +17 -0
  36. data/examples/i18n/cs/features/division.feature +11 -0
  37. data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +24 -0
  38. data/examples/i18n/cs/lib/calculator.rb +14 -0
  39. data/examples/i18n/da/Rakefile +6 -0
  40. data/examples/i18n/da/features/sammenlaegning.feature +18 -0
  41. data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +24 -0
  42. data/examples/i18n/da/lib/lommeregner.rb +11 -0
  43. data/examples/i18n/de/Rakefile +6 -0
  44. data/examples/i18n/de/features/addition.feature +17 -0
  45. data/examples/i18n/de/features/division.feature +10 -0
  46. data/examples/i18n/de/features/step_definitions/calculator_steps.rb +24 -0
  47. data/examples/i18n/de/lib/calculator.rb +14 -0
  48. data/examples/i18n/el/Rakefile +6 -0
  49. data/examples/i18n/el/features/addition.feature +17 -0
  50. data/examples/i18n/el/features/division.feature +10 -0
  51. data/examples/i18n/el/features/step_definitions/calculator_steps.rb +24 -0
  52. data/examples/i18n/el/lib/calculator.rb +14 -0
  53. data/examples/i18n/en-lol/Rakefile +4 -0
  54. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +16 -0
  55. data/examples/i18n/en-lol/features/stuffing.feature +8 -0
  56. data/examples/i18n/en-lol/features/support/env.rb +7 -0
  57. data/examples/i18n/en-lol/lib/basket.rb +12 -0
  58. data/examples/i18n/en-lol/lib/belly.rb +11 -0
  59. data/examples/i18n/en/Rakefile +6 -0
  60. data/examples/i18n/en/features/addition.feature +17 -0
  61. data/examples/i18n/en/features/division.feature +10 -0
  62. data/examples/i18n/en/features/step_definitions/calculator_steps.rb +24 -0
  63. data/examples/i18n/en/lib/calculator.rb +14 -0
  64. data/examples/i18n/eo/Rakefile +6 -0
  65. data/examples/i18n/eo/features/adicio.feature +17 -0
  66. data/examples/i18n/eo/features/divido.feature +10 -0
  67. data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +24 -0
  68. data/examples/i18n/eo/lib/calculator.rb +14 -0
  69. data/examples/i18n/es/Rakefile +6 -0
  70. data/examples/i18n/es/features/adicion.feature +17 -0
  71. data/examples/i18n/es/features/step_definitions/calculador_steps.rb +21 -0
  72. data/examples/i18n/es/lib/calculador.rb +14 -0
  73. data/examples/i18n/et/Rakefile +6 -0
  74. data/examples/i18n/et/features/jagamine.feature +10 -0
  75. data/examples/i18n/et/features/liitmine.feature +17 -0
  76. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +24 -0
  77. data/examples/i18n/et/lib/kalkulaator.rb +14 -0
  78. data/examples/i18n/fi/Rakefile +6 -0
  79. data/examples/i18n/fi/features/jakolasku.feature +10 -0
  80. data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +24 -0
  81. data/examples/i18n/fi/features/yhteenlasku.feature +17 -0
  82. data/examples/i18n/fi/lib/laskin.rb +14 -0
  83. data/examples/i18n/fr/Rakefile +8 -0
  84. data/examples/i18n/fr/features/addition.feature +18 -0
  85. data/examples/i18n/fr/features/addition2.feature +17 -0
  86. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +32 -0
  87. data/examples/i18n/fr/features/support/env.rb +5 -0
  88. data/examples/i18n/fr/lib/calculatrice.rb +10 -0
  89. data/examples/i18n/he/Rakefile +6 -0
  90. data/examples/i18n/he/features/addition.feature +17 -0
  91. data/examples/i18n/he/features/division.feature +10 -0
  92. data/examples/i18n/he/features/step_definitions/calculator_steps.rb +24 -0
  93. data/examples/i18n/he/lib/calculator.rb +15 -0
  94. data/examples/i18n/hi/Rakefile +6 -0
  95. data/examples/i18n/hi/features/addition.feature +16 -0
  96. data/examples/i18n/hi/features/division.feature +10 -0
  97. data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +24 -0
  98. data/examples/i18n/hi/lib/calculator.rb +15 -0
  99. data/examples/i18n/ht/Rakefile +6 -0
  100. data/examples/i18n/ht/features/adisyon.feature +17 -0
  101. data/examples/i18n/ht/features/divizyon.feature +10 -0
  102. data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +25 -0
  103. data/examples/i18n/ht/lib/kalkilatris.rb +14 -0
  104. data/examples/i18n/hu/Rakefile +6 -0
  105. data/examples/i18n/hu/features/osszeadas.feature +17 -0
  106. data/examples/i18n/hu/features/osztas.feature +10 -0
  107. data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +25 -0
  108. data/examples/i18n/hu/lib/calculator.rb +14 -0
  109. data/examples/i18n/id/Rakefile +6 -0
  110. data/examples/i18n/id/features/addition.feature +17 -0
  111. data/examples/i18n/id/features/division.feature +10 -0
  112. data/examples/i18n/id/features/step_definitions/calculator_steps.rb +24 -0
  113. data/examples/i18n/id/lib/calculator.rb +14 -0
  114. data/examples/i18n/it/Rakefile +6 -0
  115. data/examples/i18n/it/features/somma.feature +11 -0
  116. data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +24 -0
  117. data/examples/i18n/it/lib/calcolatrice.rb +11 -0
  118. data/examples/i18n/ja/Rakefile +6 -0
  119. data/examples/i18n/ja/features/addition.feature +17 -0
  120. data/examples/i18n/ja/features/division.feature +10 -0
  121. data/examples/i18n/ja/features/step_definitions/calculator_steps.rb +19 -0
  122. data/examples/i18n/ja/features/support/env.rb +5 -0
  123. data/examples/i18n/ja/lib/calculator.rb +14 -0
  124. data/examples/i18n/ko/Rakefile +6 -0
  125. data/examples/i18n/ko/features/addition.feature +17 -0
  126. data/examples/i18n/ko/features/division.feature +11 -0
  127. data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +24 -0
  128. data/examples/i18n/ko/lib/calculator.rb +14 -0
  129. data/examples/i18n/lt/Rakefile +6 -0
  130. data/examples/i18n/lt/features/addition.feature +17 -0
  131. data/examples/i18n/lt/features/division.feature +10 -0
  132. data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +24 -0
  133. data/examples/i18n/lt/lib/calculator.rb +14 -0
  134. data/examples/i18n/lv/Rakefile +6 -0
  135. data/examples/i18n/lv/features/addition.feature +17 -0
  136. data/examples/i18n/lv/features/division.feature +10 -0
  137. data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +24 -0
  138. data/examples/i18n/lv/lib/calculator.rb +14 -0
  139. data/examples/i18n/no/Rakefile +6 -0
  140. data/examples/i18n/no/features/step_definitions/kalkulator_steps.rb +17 -0
  141. data/examples/i18n/no/features/summering.feature +19 -0
  142. data/examples/i18n/no/features/support/env.rb +6 -0
  143. data/examples/i18n/no/lib/kalkulator.rb +11 -0
  144. data/examples/i18n/pl/Rakefile +6 -0
  145. data/examples/i18n/pl/features/addition.feature +17 -0
  146. data/examples/i18n/pl/features/division.feature +10 -0
  147. data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +24 -0
  148. data/examples/i18n/pl/features/support/env.rb +5 -0
  149. data/examples/i18n/pl/lib/calculator.rb +14 -0
  150. data/examples/i18n/pt/Rakefile +6 -0
  151. data/examples/i18n/pt/features/adicao.feature +11 -0
  152. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +20 -0
  153. data/examples/i18n/pt/features/support/env.rb +5 -0
  154. data/examples/i18n/pt/lib/calculadora.rb +10 -0
  155. data/examples/i18n/ro/Rakefile +6 -0
  156. data/examples/i18n/ro/features/adunare.feature +12 -0
  157. data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +21 -0
  158. data/examples/i18n/ro/lib/calculator.rb +11 -0
  159. data/examples/i18n/ru/Rakefile +6 -0
  160. data/examples/i18n/ru/features/addition.feature +11 -0
  161. data/examples/i18n/ru/features/consecutive_calculations.feature +17 -0
  162. data/examples/i18n/ru/features/division.feature +16 -0
  163. data/examples/i18n/ru/features/step_definitions/calculator_steps.rb +19 -0
  164. data/examples/i18n/ru/features/support/env.rb +5 -0
  165. data/examples/i18n/ru/features/support/world.rb +8 -0
  166. data/examples/i18n/ru/lib/calculator.rb +24 -0
  167. data/examples/i18n/sk/Rakefile +6 -0
  168. data/examples/i18n/sk/features/addition.feature +17 -0
  169. data/examples/i18n/sk/features/division.feature +10 -0
  170. data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +24 -0
  171. data/examples/i18n/sk/lib/calculator.rb +14 -0
  172. data/examples/i18n/sr-Cyrl/Rakefile +6 -0
  173. data/examples/i18n/sr-Cyrl/features/sabiranje.feature +18 -0
  174. data/examples/i18n/sr-Cyrl/features/step_definitions/calculator_steps.rb +20 -0
  175. data/examples/i18n/sr-Cyrl/features/support/env.rb +5 -0
  176. data/examples/i18n/sr-Cyrl/lib/calculator.rb +12 -0
  177. data/examples/i18n/sr-Latn/Rakefile +6 -0
  178. data/examples/i18n/sr-Latn/features/sabiranje.feature +18 -0
  179. data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +24 -0
  180. data/examples/i18n/sr-Latn/lib/calculator.rb +12 -0
  181. data/examples/i18n/sv/Rakefile +6 -0
  182. data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +24 -0
  183. data/examples/i18n/sv/features/summering.feature +18 -0
  184. data/examples/i18n/sv/lib/kalkulator.rb +11 -0
  185. data/examples/i18n/tr/Rakefile +6 -0
  186. data/examples/i18n/tr/features/bolme.feature +10 -0
  187. data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +24 -0
  188. data/examples/i18n/tr/features/toplama.feature +18 -0
  189. data/examples/i18n/tr/lib/hesap_makinesi.rb +15 -0
  190. data/examples/i18n/uk/Rakefile +6 -0
  191. data/examples/i18n/uk/features/addition.feature +11 -0
  192. data/examples/i18n/uk/features/consecutive_calculations.feature +17 -0
  193. data/examples/i18n/uk/features/division.feature +16 -0
  194. data/examples/i18n/uk/features/step_definitions/calculator_steps.rb +19 -0
  195. data/examples/i18n/uk/features/support/env.rb +5 -0
  196. data/examples/i18n/uk/features/support/world.rb +8 -0
  197. data/examples/i18n/uk/lib/calculator.rb +24 -0
  198. data/examples/i18n/uz/Rakefile +6 -0
  199. data/examples/i18n/uz/features/addition.feature +10 -0
  200. data/examples/i18n/uz/features/consecutive_calculations.feature +17 -0
  201. data/examples/i18n/uz/features/division.feature +17 -0
  202. data/examples/i18n/uz/features/step_definitions/calculator_steps.rb +19 -0
  203. data/examples/i18n/uz/features/support/env.rb +5 -0
  204. data/examples/i18n/uz/features/support/world.rb +8 -0
  205. data/examples/i18n/uz/lib/calculator.rb +24 -0
  206. data/examples/i18n/zh-CN/Rakefile +4 -0
  207. data/examples/i18n/zh-CN/features/addition.feature +18 -0
  208. data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +26 -0
  209. data/examples/i18n/zh-CN/lib/calculator.rb +10 -0
  210. data/examples/i18n/zh-TW/Rakefile +4 -0
  211. data/examples/i18n/zh-TW/features/addition.feature +17 -0
  212. data/examples/i18n/zh-TW/features/division.feature +11 -0
  213. data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +24 -0
  214. data/examples/i18n/zh-TW/lib/calculator.rb +14 -0
  215. data/examples/mobiusloop/increase_readers.goal +13 -0
  216. data/examples/mobiusloop/scale_page_response.rb +20 -0
  217. data/examples/mobiusloop/total_articles_scale.rb +10 -0
  218. data/examples/mobiusloop/total_readers_scale.rb +10 -0
  219. data/examples/rspec_doubles/Rakefile +4 -0
  220. data/examples/rspec_doubles/features/mocking.feature +9 -0
  221. data/examples/rspec_doubles/features/step_definitions/calvin_steps.rb +19 -0
  222. data/examples/rspec_doubles/features/support/env.rb +12 -0
  223. data/examples/sinatra/README.textile +13 -0
  224. data/examples/sinatra/Rakefile +6 -0
  225. data/examples/sinatra/app.rb +14 -0
  226. data/examples/sinatra/features/add.feature +11 -0
  227. data/examples/sinatra/features/step_definitions/add_steps.rb +15 -0
  228. data/examples/sinatra/features/support/env.rb +10 -0
  229. data/examples/sinatra/views/add.erb +7 -0
  230. data/examples/sinatra/views/layout.erb +8 -0
  231. data/examples/tcl/README.textile +11 -0
  232. data/examples/tcl/Rakefile +6 -0
  233. data/examples/tcl/features/fibonnacci.feature +17 -0
  234. data/examples/tcl/features/step_definitions/fib_steps.rb +7 -0
  235. data/examples/tcl/features/support/env.rb +6 -0
  236. data/examples/tcl/src/fib.tcl +3 -0
  237. data/examples/test_unit/Gemfile +4 -0
  238. data/examples/test_unit/Rakefile +6 -0
  239. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +20 -0
  240. data/examples/test_unit/features/test_unit.feature +9 -0
  241. data/examples/watir/README.textile +16 -0
  242. data/examples/watir/Rakefile +12 -0
  243. data/examples/watir/cucumber.yml +1 -0
  244. data/examples/watir/features/search.feature +12 -0
  245. data/examples/watir/features/step_definitions/search_steps.rb +26 -0
  246. data/examples/watir/features/support/env.rb +35 -0
  247. data/examples/watir/features/support/screenshots.rb +47 -0
  248. data/features/docs/api/list_step_defs_as_json.feature +50 -0
  249. data/features/docs/api/listen_for_events.feature +58 -0
  250. data/features/docs/api/run_cli_main_with_existing_runtime.feature +26 -0
  251. data/features/docs/cli/backtraces.feature +36 -0
  252. data/features/docs/cli/dry_run.feature +70 -0
  253. data/features/docs/cli/exclude_files.feature +18 -0
  254. data/features/docs/cli/execute_with_tag_filter.feature +117 -0
  255. data/features/docs/cli/fail_fast.feature +46 -0
  256. data/features/docs/cli/finding_steps.feature +28 -0
  257. data/features/docs/cli/randomize.feature +140 -0
  258. data/features/docs/cli/require.feature +27 -0
  259. data/features/docs/cli/retry_failing_tests.feature +32 -0
  260. data/features/docs/cli/run_scenarios_matching_name.feature +104 -0
  261. data/features/docs/cli/run_specific_scenarios.feature +77 -0
  262. data/features/docs/cli/showing_differences.feature +43 -0
  263. data/features/docs/cli/specifying_multiple_formatters.feature +65 -0
  264. data/features/docs/cli/strict_mode.feature +64 -0
  265. data/features/docs/defining_steps/nested_steps.feature +177 -0
  266. data/features/docs/defining_steps/nested_steps_i18n.feature +34 -0
  267. data/features/docs/defining_steps/nested_steps_with_second_arg.feature +54 -0
  268. data/features/docs/defining_steps/one_line_step_definitions.feature +65 -0
  269. data/features/docs/defining_steps/printing_messages.feature +148 -0
  270. data/features/docs/defining_steps/skip_scenario.feature +64 -0
  271. data/features/docs/defining_steps/snippets.feature +56 -0
  272. data/features/docs/defining_steps/table_diffing.feature +50 -0
  273. data/features/docs/exception_in_after_hook.feature +126 -0
  274. data/features/docs/exception_in_after_step_hook.feature +102 -0
  275. data/features/docs/exception_in_around_hook.feature +78 -0
  276. data/features/docs/exception_in_before_hook.feature +96 -0
  277. data/features/docs/extending_cucumber/custom_filter.feature +29 -0
  278. data/features/docs/extending_cucumber/custom_formatter.feature +130 -0
  279. data/features/docs/formatters/api_methods.feature +37 -0
  280. data/features/docs/formatters/debug_formatter.feature +47 -0
  281. data/features/docs/formatters/formatter_step_file_colon_line.feature +44 -0
  282. data/features/docs/formatters/html_formatter.feature +91 -0
  283. data/features/docs/formatters/json_formatter.feature +767 -0
  284. data/features/docs/formatters/junit_formatter.feature +454 -0
  285. data/features/docs/formatters/pretty_formatter.feature +73 -0
  286. data/features/docs/formatters/progress_formatter.feature +31 -0
  287. data/features/docs/formatters/rerun_formatter.feature +188 -0
  288. data/features/docs/formatters/usage_formatter.feature +98 -0
  289. data/features/docs/getting_started.feature +27 -0
  290. data/features/docs/gherkin/background.feature +548 -0
  291. data/features/docs/gherkin/doc_strings.feature +74 -0
  292. data/features/docs/gherkin/expand_option_for_outlines.feature +46 -0
  293. data/features/docs/gherkin/language_from_header.feature +32 -0
  294. data/features/docs/gherkin/language_help.feature +42 -0
  295. data/features/docs/gherkin/outlines.feature +156 -0
  296. data/features/docs/gherkin/unicode_table.feature +32 -0
  297. data/features/docs/gherkin/using_descriptions.feature +82 -0
  298. data/features/docs/gherkin/using_star_notation.feature +37 -0
  299. data/features/docs/iso-8859-1.feature +6 -0
  300. data/features/docs/post_configuration_hook.feature +49 -0
  301. data/features/docs/profiles.feature +120 -0
  302. data/features/docs/rake_task.feature +141 -0
  303. data/features/docs/raketask.feature +44 -0
  304. data/features/docs/work_in_progress.feature +154 -0
  305. data/features/docs/writing_support_code/after_hooks.feature +102 -0
  306. data/features/docs/writing_support_code/after_step_hooks.feature +53 -0
  307. data/features/docs/writing_support_code/around_hooks.feature +260 -0
  308. data/features/docs/writing_support_code/before_hook.feature +65 -0
  309. data/features/docs/writing_support_code/hook_order.feature +61 -0
  310. data/features/docs/writing_support_code/load_path.feature +17 -0
  311. data/features/docs/writing_support_code/state.feature +32 -0
  312. data/features/docs/writing_support_code/tagged_hooks.feature +95 -0
  313. data/features/docs/writing_support_code/transforms.feature +98 -0
  314. data/features/lib/step_definitions/aruba_steps.rb +26 -0
  315. data/features/lib/step_definitions/cucumber_steps.rb +78 -0
  316. data/features/lib/step_definitions/iso-8859-1_steps.rb +12 -0
  317. data/features/lib/step_definitions/json_steps.rb +7 -0
  318. data/features/lib/step_definitions/junit_steps.rb +13 -0
  319. data/features/lib/step_definitions/language_steps.rb +8 -0
  320. data/features/lib/step_definitions/profile_steps.rb +15 -0
  321. data/features/lib/step_definitions/retry_steps.rb +35 -0
  322. data/features/lib/step_definitions/ruby_steps.rb +3 -0
  323. data/features/lib/step_definitions/wire_steps.rb +58 -0
  324. data/features/lib/support/env.rb +21 -0
  325. data/features/lib/support/fake_wire_server.rb +80 -0
  326. data/features/lib/support/feature_factory.rb +67 -0
  327. data/features/lib/support/normalise_output.rb +50 -0
  328. data/gem_tasks/contributors.rake +15 -0
  329. data/gem_tasks/cov.rake +5 -0
  330. data/gem_tasks/cucumber.rake +25 -0
  331. data/gem_tasks/downloads.rb +7 -0
  332. data/gem_tasks/environment.rake +7 -0
  333. data/gem_tasks/examples.rake +11 -0
  334. data/gem_tasks/fix_cr_lf.rake +10 -0
  335. data/gem_tasks/flog.rake +4 -0
  336. data/gem_tasks/rspec.rake +6 -0
  337. data/gem_tasks/sass.rake +4 -0
  338. data/gem_tasks/stats +16 -0
  339. data/gem_tasks/versions.txt +74 -0
  340. data/gherkin-languages.json +2972 -0
  341. data/lib/autotest/cucumber.rb +6 -0
  342. data/lib/autotest/cucumber_mixin.rb +135 -0
  343. data/lib/autotest/cucumber_rails.rb +6 -0
  344. data/lib/autotest/cucumber_rails_rspec.rb +6 -0
  345. data/lib/autotest/cucumber_rails_rspec2.rb +6 -0
  346. data/lib/autotest/cucumber_rspec.rb +6 -0
  347. data/lib/autotest/cucumber_rspec2.rb +6 -0
  348. data/lib/autotest/discover.rb +11 -0
  349. data/lib/cucumber.rb +37 -0
  350. data/lib/cucumber/ast.rb +13 -0
  351. data/lib/cucumber/cli/configuration.rb +146 -0
  352. data/lib/cucumber/cli/main.rb +99 -0
  353. data/lib/cucumber/cli/options.rb +465 -0
  354. data/lib/cucumber/cli/profile_loader.rb +91 -0
  355. data/lib/cucumber/cli/rerun_file.rb +29 -0
  356. data/lib/cucumber/configuration.rb +268 -0
  357. data/lib/cucumber/constantize.rb +45 -0
  358. data/lib/cucumber/core_ext/instance_exec.rb +70 -0
  359. data/lib/cucumber/core_ext/string.rb +9 -0
  360. data/lib/cucumber/deprecate.rb +29 -0
  361. data/lib/cucumber/encoding.rb +5 -0
  362. data/lib/cucumber/errors.rb +51 -0
  363. data/lib/cucumber/events.rb +20 -0
  364. data/lib/cucumber/events/after_test_case.rb +25 -0
  365. data/lib/cucumber/events/after_test_step.rb +30 -0
  366. data/lib/cucumber/events/before_test_case.rb +18 -0
  367. data/lib/cucumber/events/before_test_step.rb +23 -0
  368. data/lib/cucumber/events/bus.rb +86 -0
  369. data/lib/cucumber/events/finished_testing.rb +9 -0
  370. data/lib/cucumber/events/step_match.rb +23 -0
  371. data/lib/cucumber/file_specs.rb +37 -0
  372. data/lib/cucumber/filters.rb +9 -0
  373. data/lib/cucumber/filters/activate_steps.rb +67 -0
  374. data/lib/cucumber/filters/apply_after_hooks.rb +9 -0
  375. data/lib/cucumber/filters/apply_after_step_hooks.rb +12 -0
  376. data/lib/cucumber/filters/apply_around_hooks.rb +12 -0
  377. data/lib/cucumber/filters/apply_before_hooks.rb +9 -0
  378. data/lib/cucumber/filters/gated_receiver.rb +25 -0
  379. data/lib/cucumber/filters/prepare_world.rb +45 -0
  380. data/lib/cucumber/filters/quit.rb +28 -0
  381. data/lib/cucumber/filters/randomizer.rb +45 -0
  382. data/lib/cucumber/filters/retry.rb +32 -0
  383. data/lib/cucumber/filters/tag_limits.rb +45 -0
  384. data/lib/cucumber/filters/tag_limits/test_case_index.rb +31 -0
  385. data/lib/cucumber/filters/tag_limits/verifier.rb +59 -0
  386. data/lib/cucumber/formatter/ansicolor.rb +160 -0
  387. data/lib/cucumber/formatter/backtrace_filter.rb +41 -0
  388. data/lib/cucumber/formatter/console.rb +252 -0
  389. data/lib/cucumber/formatter/cucumber.css +286 -0
  390. data/lib/cucumber/formatter/cucumber.sass +247 -0
  391. data/lib/cucumber/formatter/debug.rb +35 -0
  392. data/lib/cucumber/formatter/duration.rb +13 -0
  393. data/lib/cucumber/formatter/duration_extractor.rb +28 -0
  394. data/lib/cucumber/formatter/event_bus_report.rb +38 -0
  395. data/lib/cucumber/formatter/fail_fast.rb +18 -0
  396. data/lib/cucumber/formatter/fanout.rb +27 -0
  397. data/lib/cucumber/formatter/hook_query_visitor.rb +40 -0
  398. data/lib/cucumber/formatter/html.rb +689 -0
  399. data/lib/cucumber/formatter/ignore_missing_messages.rb +20 -0
  400. data/lib/cucumber/formatter/interceptor.rb +80 -0
  401. data/lib/cucumber/formatter/io.rb +34 -0
  402. data/lib/cucumber/formatter/jquery-min.js +154 -0
  403. data/lib/cucumber/formatter/json.rb +334 -0
  404. data/lib/cucumber/formatter/json_pretty.rb +10 -0
  405. data/lib/cucumber/formatter/junit.rb +238 -0
  406. data/lib/cucumber/formatter/legacy_api/adapter.rb +1016 -0
  407. data/lib/cucumber/formatter/legacy_api/ast.rb +389 -0
  408. data/lib/cucumber/formatter/legacy_api/results.rb +51 -0
  409. data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +31 -0
  410. data/lib/cucumber/formatter/pretty.rb +247 -0
  411. data/lib/cucumber/formatter/progress.rb +73 -0
  412. data/lib/cucumber/formatter/rerun.rb +35 -0
  413. data/lib/cucumber/formatter/stepdefs.rb +14 -0
  414. data/lib/cucumber/formatter/steps.rb +49 -0
  415. data/lib/cucumber/formatter/summary.rb +35 -0
  416. data/lib/cucumber/formatter/unicode.rb +53 -0
  417. data/lib/cucumber/formatter/usage.rb +136 -0
  418. data/lib/cucumber/gherkin/data_table_parser.rb +31 -0
  419. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +99 -0
  420. data/lib/cucumber/gherkin/formatter/escaping.rb +17 -0
  421. data/lib/cucumber/gherkin/i18n.rb +15 -0
  422. data/lib/cucumber/gherkin/steps_parser.rb +31 -0
  423. data/lib/cucumber/hooks.rb +99 -0
  424. data/lib/cucumber/load_path.rb +13 -0
  425. data/lib/cucumber/multiline_argument.rb +71 -0
  426. data/lib/cucumber/multiline_argument/data_table.rb +744 -0
  427. data/lib/cucumber/multiline_argument/doc_string.rb +9 -0
  428. data/lib/cucumber/platform.rb +27 -0
  429. data/lib/cucumber/project_initializer.rb +82 -0
  430. data/lib/cucumber/rake/task.rb +168 -0
  431. data/lib/cucumber/rb_support/rb_dsl.rb +119 -0
  432. data/lib/cucumber/rb_support/rb_hook.rb +19 -0
  433. data/lib/cucumber/rb_support/rb_language.rb +216 -0
  434. data/lib/cucumber/rb_support/rb_step_definition.rb +131 -0
  435. data/lib/cucumber/rb_support/rb_transform.rb +59 -0
  436. data/lib/cucumber/rb_support/rb_world.rb +149 -0
  437. data/lib/cucumber/rb_support/snippet.rb +170 -0
  438. data/lib/cucumber/rspec/disable_option_parser.rb +23 -0
  439. data/lib/cucumber/rspec/doubles.rb +19 -0
  440. data/lib/cucumber/running_test_case.rb +134 -0
  441. data/lib/cucumber/runtime.rb +266 -0
  442. data/lib/cucumber/runtime/after_hooks.rb +25 -0
  443. data/lib/cucumber/runtime/before_hooks.rb +27 -0
  444. data/lib/cucumber/runtime/for_programming_languages.rb +66 -0
  445. data/lib/cucumber/runtime/step_hooks.rb +23 -0
  446. data/lib/cucumber/runtime/support_code.rb +151 -0
  447. data/lib/cucumber/runtime/user_interface.rb +85 -0
  448. data/lib/cucumber/step_argument.rb +25 -0
  449. data/lib/cucumber/step_definition_light.rb +20 -0
  450. data/lib/cucumber/step_definitions.rb +13 -0
  451. data/lib/cucumber/step_match.rb +141 -0
  452. data/lib/cucumber/step_match_search.rb +67 -0
  453. data/lib/cucumber/term/ansicolor.rb +110 -0
  454. data/lib/cucumber/unit.rb +11 -0
  455. data/lib/cucumber/version +1 -0
  456. data/lib/mobiusloop/measure.rb +19 -0
  457. data/lib/mobiusloop/mobius_steps.rb +36 -0
  458. data/lib/mobiusloop/objective.rb +10 -0
  459. data/lib/mobiusloop/outcome.rb +99 -0
  460. data/lib/mobiusloop/scale.rb +32 -0
  461. data/lib/simplecov_setup.rb +18 -0
  462. data/major_changes_to_cucumber.md +45 -0
  463. data/mobiusloop.gemspec +47 -0
  464. data/spec/cucumber/cli/configuration_spec.rb +435 -0
  465. data/spec/cucumber/cli/main_spec.rb +83 -0
  466. data/spec/cucumber/cli/options_spec.rb +410 -0
  467. data/spec/cucumber/cli/profile_loader_spec.rb +46 -0
  468. data/spec/cucumber/cli/rerun_spec.rb +85 -0
  469. data/spec/cucumber/configuration_spec.rb +147 -0
  470. data/spec/cucumber/constantize_spec.rb +19 -0
  471. data/spec/cucumber/core_ext/instance_exec_spec.rb +4 -0
  472. data/spec/cucumber/events/bus_spec.rb +94 -0
  473. data/spec/cucumber/file_specs_spec.rb +60 -0
  474. data/spec/cucumber/filters/activate_steps_spec.rb +149 -0
  475. data/spec/cucumber/filters/gated_receiver_spec.rb +47 -0
  476. data/spec/cucumber/filters/retry_spec.rb +79 -0
  477. data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +38 -0
  478. data/spec/cucumber/filters/tag_limits/verifier_spec.rb +57 -0
  479. data/spec/cucumber/filters/tag_limits_spec.rb +59 -0
  480. data/spec/cucumber/formatter/ansicolor_spec.rb +32 -0
  481. data/spec/cucumber/formatter/debug_spec.rb +64 -0
  482. data/spec/cucumber/formatter/duration_spec.rb +22 -0
  483. data/spec/cucumber/formatter/event_bus_report_spec.rb +88 -0
  484. data/spec/cucumber/formatter/fail_fast_spec.rb +88 -0
  485. data/spec/cucumber/formatter/html_spec.rb +538 -0
  486. data/spec/cucumber/formatter/interceptor_spec.rb +136 -0
  487. data/spec/cucumber/formatter/json_spec.rb +841 -0
  488. data/spec/cucumber/formatter/junit_spec.rb +252 -0
  489. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +2182 -0
  490. data/spec/cucumber/formatter/pretty_spec.rb +919 -0
  491. data/spec/cucumber/formatter/progress_spec.rb +169 -0
  492. data/spec/cucumber/formatter/rerun_spec.rb +91 -0
  493. data/spec/cucumber/formatter/spec_helper.rb +82 -0
  494. data/spec/cucumber/hooks_spec.rb +30 -0
  495. data/spec/cucumber/multiline_argument/data_table_spec.rb +603 -0
  496. data/spec/cucumber/project_initializer_spec.rb +87 -0
  497. data/spec/cucumber/rake/forked_spec.rb +53 -0
  498. data/spec/cucumber/rake/task_spec.rb +85 -0
  499. data/spec/cucumber/rb_support/rb_language_spec.rb +243 -0
  500. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +199 -0
  501. data/spec/cucumber/rb_support/rb_transform_spec.rb +46 -0
  502. data/spec/cucumber/rb_support/rb_world_spec.rb +47 -0
  503. data/spec/cucumber/rb_support/snippet_spec.rb +137 -0
  504. data/spec/cucumber/running_test_case_spec.rb +139 -0
  505. data/spec/cucumber/runtime/for_programming_languages_spec.rb +36 -0
  506. data/spec/cucumber/runtime/support_code_spec.rb +16 -0
  507. data/spec/cucumber/runtime_spec.rb +20 -0
  508. data/spec/cucumber/sell_cucumbers.feature +19 -0
  509. data/spec/cucumber/step_argument_spec.rb +18 -0
  510. data/spec/cucumber/step_match_search_spec.rb +122 -0
  511. data/spec/cucumber/step_match_spec.rb +85 -0
  512. data/spec/cucumber/world/pending_spec.rb +47 -0
  513. data/spec/cucumber_spec.rb +39 -0
  514. data/spec/spec_helper.rb +29 -0
  515. data/spec/support/standard_step_actions.rb +18 -0
  516. metadata +1007 -0
@@ -0,0 +1,252 @@
1
+ require 'spec_helper'
2
+ require 'cucumber/formatter/spec_helper'
3
+
4
+ require 'cucumber/formatter/junit'
5
+ require 'nokogiri'
6
+
7
+ module Cucumber
8
+ module Formatter
9
+ describe Junit do
10
+ extend SpecHelperDsl
11
+ include SpecHelper
12
+
13
+ class TestDoubleJunitFormatter < Junit
14
+ attr_reader :written_files
15
+
16
+ def write_file(feature_filename, data)
17
+ @written_files ||= {}
18
+ @written_files[feature_filename] = data
19
+ end
20
+ end
21
+
22
+ context "With no options" do
23
+ before(:each) do
24
+ allow(File).to receive(:directory?) { true }
25
+ @formatter = TestDoubleJunitFormatter.new(actual_runtime.configuration.with_options(out_stream: ''))
26
+ end
27
+
28
+ after(:each) do
29
+ $stdout = STDOUT
30
+ end
31
+
32
+ describe "is able to strip control chars from cdata" do
33
+ before(:each) do
34
+ run_defined_feature
35
+ @doc = Nokogiri.XML(@formatter.written_files.values.first)
36
+ end
37
+ define_feature "
38
+ Feature: One passing scenario, one failing scenario
39
+
40
+ Scenario: Passing
41
+ Given a passing ctrl scenario
42
+ "
43
+ class Junit
44
+ def before_step(step)
45
+ if step.name.match("a passing ctrl scenario")
46
+ Interceptor::Pipe.unwrap! :stdout
47
+ @fake_io = $stdout = StringIO.new
48
+ $stdout.sync = true
49
+ @interceptedout = Interceptor::Pipe.wrap(:stdout)
50
+ end
51
+ end
52
+
53
+ def after_step(step)
54
+ if step.name.match("a passing ctrl scenario")
55
+ @interceptedout.write("boo\b\cx\e\a\f boo ")
56
+ $stdout = STDOUT
57
+ @fake_io.close
58
+ end
59
+ end
60
+ end
61
+
62
+ it { expect(@doc.xpath('//testsuite/testcase/system-out').first.content).to match(/\s+boo boo\s+/) }
63
+ end
64
+
65
+ describe "a feature with no name" do
66
+ define_feature <<-FEATURE
67
+ Feature:
68
+ Scenario: Passing
69
+ Given a passing scenario
70
+ FEATURE
71
+
72
+ it "raises an exception" do
73
+ expect(-> {
74
+ run_defined_feature
75
+ }).to raise_error(Junit::UnNamedFeatureError)
76
+ end
77
+ end
78
+
79
+ describe "given a single feature" do
80
+ before(:each) do
81
+ run_defined_feature
82
+ @doc = Nokogiri.XML(@formatter.written_files.values.first)
83
+ end
84
+
85
+ describe "with a single scenario" do
86
+ define_feature <<-FEATURE
87
+ Feature: One passing scenario, one failing scenario
88
+
89
+ Scenario: Passing
90
+ Given a passing scenario
91
+ FEATURE
92
+
93
+ it { expect(@doc.to_s).to match /One passing scenario, one failing scenario/ }
94
+
95
+ it 'has not a root system-out node' do
96
+ expect(@doc.xpath('//testsuite/system-out').size).to eq 0
97
+ end
98
+
99
+ it 'has not a root system-err node' do
100
+ expect(@doc.xpath('//testsuite/system-err').size).to eq 0
101
+ end
102
+
103
+ it 'has a system-out node under <testcase/>' do
104
+ expect(@doc.xpath('//testcase/system-out').size).to eq 1
105
+ end
106
+
107
+ it 'has a system-err node under <testcase/>' do
108
+ expect(@doc.xpath('//testcase/system-err').size).to eq 1
109
+ end
110
+ end
111
+
112
+ describe "with a scenario in a subdirectory" do
113
+ define_feature %{
114
+ Feature: One passing scenario, one failing scenario
115
+
116
+ Scenario: Passing
117
+ Given a passing scenario
118
+ }, File.join('features', 'some', 'path', 'spec.feature')
119
+
120
+ it 'writes the filename including the subdirectory' do
121
+ expect(@formatter.written_files.keys.first).to eq File.join('', 'TEST-features-some-path-spec.xml')
122
+ end
123
+ end
124
+
125
+ describe "with a scenario outline table" do
126
+ define_steps do
127
+ Given(/.*/) { }
128
+ end
129
+
130
+ define_feature <<-FEATURE
131
+ Feature: Eat things when hungry
132
+
133
+ Scenario Outline: Eat things
134
+ Given <Things>
135
+ And stuff:
136
+ | foo |
137
+ | bar |
138
+
139
+ Examples: Good
140
+ | Things |
141
+ | Cucumber |
142
+ | Whisky |
143
+ Examples: Evil
144
+ | Things |
145
+ | Big Mac |
146
+ FEATURE
147
+
148
+ it { expect(@doc.to_s).to match /Eat things when hungry/ }
149
+ it { expect(@doc.to_s).to match /Cucumber/ }
150
+ it { expect(@doc.to_s).to match /Whisky/ }
151
+ it { expect(@doc.to_s).to match /Big Mac/ }
152
+ it { expect(@doc.to_s).not_to match /Things/ }
153
+ it { expect(@doc.to_s).not_to match /Good|Evil/ }
154
+ it { expect(@doc.to_s).not_to match /type="skipped"/}
155
+ end
156
+
157
+ describe "scenario with skipped test in junit report" do
158
+ define_feature <<-FEATURE
159
+ Feature: junit report with skipped test
160
+
161
+ Scenario Outline: skip a test and junit report of the same
162
+ Given a <skip> scenario
163
+
164
+ Examples:
165
+ | skip |
166
+ | undefined |
167
+ | still undefined |
168
+ FEATURE
169
+
170
+ it { expect(@doc.to_s).to match /skipped="2"/}
171
+ end
172
+
173
+ describe "with a regular data table scenario" do
174
+ define_steps do
175
+ Given(/the following items on a shortlist/) { |table| }
176
+ When(/I go.*/) { }
177
+ Then(/I should have visited at least/) { |table| }
178
+ end
179
+
180
+ define_feature <<-FEATURE
181
+ Feature: Shortlist
182
+
183
+ Scenario: Procure items
184
+ Given the following items on a shortlist:
185
+ | item |
186
+ | milk |
187
+ | cookies |
188
+ When I get some..
189
+ Then I'll eat 'em
190
+
191
+ FEATURE
192
+ # these type of tables shouldn't crash (or generate test cases)
193
+ it { expect(@doc.to_s).not_to match /milk/ }
194
+ it { expect(@doc.to_s).not_to match /cookies/ }
195
+ end
196
+ end
197
+ end
198
+
199
+ context "In --expand mode" do
200
+ let(:runtime) { Runtime.new({:expand => true}) }
201
+ before(:each) do
202
+ allow(File).to receive(:directory?) { true }
203
+ @formatter = TestDoubleJunitFormatter.new(actual_runtime.configuration.with_options(out_stream: '', :expand => true))
204
+ end
205
+
206
+ after(:each) do
207
+ $stdout = STDOUT
208
+ end
209
+
210
+ describe "given a single feature" do
211
+ before(:each) do
212
+ run_defined_feature
213
+ @doc = Nokogiri.XML(@formatter.written_files.values.first)
214
+ end
215
+
216
+ describe "with a scenario outline table" do
217
+ define_steps do
218
+ Given(/.*/) { }
219
+ end
220
+
221
+ define_feature <<-FEATURE
222
+ Feature: Eat things when hungry
223
+
224
+ Scenario Outline: Eat things
225
+ Given <Things>
226
+ And stuff:
227
+ | foo |
228
+ | bar |
229
+
230
+ Examples: Good
231
+ | Things |
232
+ | Cucumber |
233
+ | Whisky |
234
+ Examples: Evil
235
+ | Things |
236
+ | Big Mac |
237
+ FEATURE
238
+
239
+ it { expect(@doc.to_s).to match /Eat things when hungry/ }
240
+ it { expect(@doc.to_s).to match /Cucumber/ }
241
+ it { expect(@doc.to_s).to match /Whisky/ }
242
+ it { expect(@doc.to_s).to match /Big Mac/ }
243
+ it { expect(@doc.to_s).not_to match /Things/ }
244
+ it { expect(@doc.to_s).not_to match /Good|Evil/ }
245
+ it { expect(@doc.to_s).not_to match /type="skipped"/}
246
+ end
247
+ end
248
+
249
+ end
250
+ end
251
+ end
252
+ end
@@ -0,0 +1,2182 @@
1
+ require 'cucumber/formatter/legacy_api/adapter'
2
+ require 'cucumber/core'
3
+ require 'cucumber/core/gherkin/writer'
4
+ require 'cucumber/runtime/step_hooks'
5
+ require 'cucumber/runtime/before_hooks'
6
+ require 'cucumber/runtime/after_hooks'
7
+ require 'cucumber/filters'
8
+ require 'spec_helper'
9
+
10
+ module Cucumber
11
+ module Formatter::LegacyApi
12
+ describe Adapter do
13
+ include Core::Gherkin::Writer
14
+ include Core
15
+
16
+ let(:report) { Adapter.new(formatter, runtime.results, runtime.configuration) }
17
+ let(:formatter) { double('formatter').as_null_object }
18
+ let(:runtime) { Runtime.new }
19
+ let(:step_match_search) { SimpleStepDefinitionSearch.new }
20
+
21
+ Failure = Class.new(StandardError)
22
+
23
+ class SimpleStepMatch
24
+ def initialize(&block)
25
+ @block = block
26
+ end
27
+
28
+ def activate(test_step)
29
+ test_step.with_action &@block
30
+ end
31
+ end
32
+
33
+ class SimpleStepDefinitionSearch
34
+ def call(name)
35
+ if name =~ /pass/
36
+ return [SimpleStepMatch.new {}]
37
+ end
38
+
39
+ if name =~ /fail/
40
+ return [SimpleStepMatch.new { raise Failure }]
41
+ end
42
+
43
+ []
44
+ end
45
+ end
46
+
47
+ class HookWrapper
48
+ def initialize(proc)
49
+ @proc = proc
50
+ end
51
+
52
+ def source_location
53
+ @proc.source_location
54
+ end
55
+
56
+ def location
57
+ source_location
58
+ end
59
+
60
+ def invoke(pseudo_method, arguments, &block)
61
+ @proc.call
62
+ end
63
+ end
64
+
65
+ class AddBeforeAndAfterHooks < Core::Filter.new
66
+ def test_case(test_case)
67
+ steps = before_hooks(test_case.source) +
68
+ test_case.test_steps +
69
+ after_hooks(test_case.source)
70
+ test_case.with_steps(steps).describe_to receiver
71
+ end
72
+
73
+ private
74
+
75
+ def before_hooks(source)
76
+ # The adapter is built on the assumption that each test case will have at least one step. This is annoying
77
+ # for tests, but a safe assumption for production use as we always add one hook to initialize the world.
78
+ hook = proc {}
79
+ [ Hooks.before_hook(source, hook.source_location, &hook) ]
80
+ end
81
+
82
+ def after_hooks(source)
83
+ # We add an after hook to make sure the adapter can cope with it
84
+ hook = proc {}
85
+ [ Hooks.after_hook(source, hook.source_location, &hook) ]
86
+ end
87
+ end
88
+
89
+ context 'message order' do
90
+ let(:formatter) { MessageSpy.new }
91
+
92
+ it 'two features' do
93
+ gherkin_docs = [
94
+ gherkin do
95
+ feature do
96
+ scenario do
97
+ step 'passing'
98
+ end
99
+ end
100
+ end,
101
+ gherkin do
102
+ feature do
103
+ scenario do
104
+ step 'passing'
105
+ end
106
+ end
107
+ end,
108
+ ]
109
+ runner = Core::Test::Runner.new(report)
110
+ compile gherkin_docs, runner, default_filters
111
+ expect( formatter.legacy_messages ).to eq [
112
+ :before_features,
113
+ :before_feature,
114
+ :before_tags,
115
+ :after_tags,
116
+ :feature_name,
117
+ :before_feature_element,
118
+ :before_tags,
119
+ :after_tags,
120
+ :scenario_name,
121
+ :before_steps,
122
+ :before_step,
123
+ :before_step_result,
124
+ :step_name,
125
+ :after_step_result,
126
+ :after_step,
127
+ :after_steps,
128
+ :after_feature_element,
129
+ :after_feature,
130
+ :before_feature,
131
+ :before_tags,
132
+ :after_tags,
133
+ :feature_name,
134
+ :before_feature_element,
135
+ :before_tags,
136
+ :after_tags,
137
+ :scenario_name,
138
+ :before_steps,
139
+ :before_step,
140
+ :before_step_result,
141
+ :step_name,
142
+ :after_step_result,
143
+ :after_step,
144
+ :after_steps,
145
+ :after_feature_element,
146
+ :after_feature,
147
+ :after_features,
148
+ ]
149
+ end
150
+
151
+ it 'a scenario with no steps' do
152
+ execute_gherkin do
153
+ feature do
154
+ scenario
155
+ end
156
+ end
157
+
158
+ expect( formatter.legacy_messages ).to eq [
159
+ :before_features,
160
+ :before_feature,
161
+ :before_tags,
162
+ :after_tags,
163
+ :feature_name,
164
+ :before_feature_element,
165
+ :before_tags,
166
+ :after_tags,
167
+ :scenario_name,
168
+ :after_feature_element,
169
+ :after_feature,
170
+ :after_features,
171
+ ]
172
+ end
173
+
174
+ it 'a scenario with no steps coming after another scenario' do
175
+ execute_gherkin do
176
+ feature do
177
+ scenario do
178
+ step 'passing'
179
+ end
180
+ scenario
181
+ end
182
+ end
183
+ expect( formatter.legacy_messages ).to eq [
184
+ :before_features,
185
+ :before_feature,
186
+ :before_tags,
187
+ :after_tags,
188
+ :feature_name,
189
+ :before_feature_element,
190
+ :before_tags,
191
+ :after_tags,
192
+ :scenario_name,
193
+ :before_steps,
194
+ :before_step,
195
+ :before_step_result,
196
+ :step_name,
197
+ :after_step_result,
198
+ :after_step,
199
+ :after_steps,
200
+ :after_feature_element,
201
+ :before_feature_element,
202
+ :before_tags,
203
+ :after_tags,
204
+ :scenario_name,
205
+ :after_feature_element,
206
+ :after_feature,
207
+ :after_features,
208
+ ]
209
+ end
210
+
211
+ it 'a scenario with one step' do
212
+ execute_gherkin do
213
+ feature do
214
+ scenario do
215
+ step 'passing'
216
+ end
217
+ end
218
+ end
219
+ expect( formatter.legacy_messages ).to eq [
220
+ :before_features,
221
+ :before_feature,
222
+ :before_tags,
223
+ :after_tags,
224
+ :feature_name,
225
+ :before_feature_element,
226
+ :before_tags,
227
+ :after_tags,
228
+ :scenario_name,
229
+ :before_steps,
230
+ :before_step,
231
+ :before_step_result,
232
+ :step_name,
233
+ :after_step_result,
234
+ :after_step,
235
+ :after_steps,
236
+ :after_feature_element,
237
+ :after_feature,
238
+ :after_features,
239
+ ]
240
+ end
241
+
242
+ it 'a scenario with two steps, one of them failing' do
243
+ execute_gherkin do
244
+ feature do
245
+ scenario do
246
+ step 'passing'
247
+ step 'failing'
248
+ end
249
+ end
250
+ end
251
+ expect( formatter.legacy_messages ).to eq [
252
+ :before_features,
253
+ :before_feature,
254
+ :before_tags,
255
+ :after_tags,
256
+ :feature_name,
257
+ :before_feature_element,
258
+ :before_tags,
259
+ :after_tags,
260
+ :scenario_name,
261
+ :before_steps,
262
+ :before_step,
263
+ :before_step_result,
264
+ :step_name,
265
+ :after_step_result,
266
+ :after_step,
267
+ :before_step,
268
+ :before_step_result,
269
+ :step_name,
270
+ :exception,
271
+ :after_step_result,
272
+ :after_step,
273
+ :after_steps,
274
+ :after_feature_element,
275
+ :after_feature,
276
+ :after_features,
277
+ ]
278
+ end
279
+
280
+ it 'a feature with two scenarios' do
281
+ execute_gherkin do
282
+ feature do
283
+ scenario do
284
+ step 'passing'
285
+ end
286
+ scenario do
287
+ step 'passing'
288
+ end
289
+ end
290
+ end
291
+ expect( formatter.legacy_messages ).to eq [
292
+ :before_features,
293
+ :before_feature,
294
+ :before_tags,
295
+ :after_tags,
296
+ :feature_name,
297
+ :before_feature_element,
298
+ :before_tags,
299
+ :after_tags,
300
+ :scenario_name,
301
+ :before_steps,
302
+ :before_step,
303
+ :before_step_result,
304
+ :step_name,
305
+ :after_step_result,
306
+ :after_step,
307
+ :after_steps,
308
+ :after_feature_element,
309
+ :before_feature_element,
310
+ :before_tags,
311
+ :after_tags,
312
+ :scenario_name,
313
+ :before_steps,
314
+ :before_step,
315
+ :before_step_result,
316
+ :step_name,
317
+ :after_step_result,
318
+ :after_step,
319
+ :after_steps,
320
+ :after_feature_element,
321
+ :after_feature,
322
+ :after_features,
323
+ ]
324
+ end
325
+
326
+ it 'a feature with a background and an empty scenario' do
327
+ execute_gherkin do
328
+ feature do
329
+ background do
330
+ step 'passing'
331
+ end
332
+ scenario
333
+ end
334
+ end
335
+ expect( formatter.legacy_messages ).to eq [
336
+ :before_features,
337
+ :before_feature,
338
+ :before_tags,
339
+ :after_tags,
340
+ :feature_name,
341
+ :before_background,
342
+ :background_name,
343
+ :before_steps,
344
+ :before_step,
345
+ :before_step_result,
346
+ :step_name,
347
+ :after_step_result,
348
+ :after_step,
349
+ :after_steps,
350
+ :after_background,
351
+ :before_feature_element,
352
+ :before_tags,
353
+ :after_tags,
354
+ :scenario_name,
355
+ :after_feature_element,
356
+ :after_feature,
357
+ :after_features,
358
+ ]
359
+ end
360
+
361
+ it 'a feature with a background and two scenarios' do
362
+ execute_gherkin do
363
+ feature do
364
+ background do
365
+ step 'passing'
366
+ end
367
+ scenario do
368
+ step 'passing'
369
+ end
370
+ scenario do
371
+ step 'passing'
372
+ end
373
+ end
374
+ end
375
+ expect( formatter.legacy_messages ).to eq [
376
+ :before_features,
377
+ :before_feature,
378
+ :before_tags,
379
+ :after_tags,
380
+ :feature_name,
381
+ :before_background,
382
+ :background_name,
383
+ :before_steps,
384
+ :before_step,
385
+ :before_step_result,
386
+ :step_name,
387
+ :after_step_result,
388
+ :after_step,
389
+ :after_steps,
390
+ :after_background,
391
+ :before_feature_element,
392
+ :before_tags,
393
+ :after_tags,
394
+ :scenario_name,
395
+ :before_steps,
396
+ :before_step,
397
+ :before_step_result,
398
+ :step_name,
399
+ :after_step_result,
400
+ :after_step,
401
+ :after_steps,
402
+ :after_feature_element,
403
+ :before_feature_element,
404
+ :before_tags,
405
+ :after_tags,
406
+ :scenario_name,
407
+ :before_steps,
408
+ :before_step,
409
+ :before_step_result,
410
+ :step_name,
411
+ :after_step_result,
412
+ :after_step,
413
+ :after_steps,
414
+ :after_feature_element,
415
+ :after_feature,
416
+ :after_features,
417
+ ]
418
+ end
419
+
420
+ it 'a feature with a background and one scenario and one scenario outline' do
421
+ execute_gherkin do
422
+ feature do
423
+ background do
424
+ step 'passing'
425
+ end
426
+ scenario do
427
+ step 'passing'
428
+ end
429
+ scenario_outline do
430
+ step '<result>ing'
431
+ examples do
432
+ row 'result'
433
+ row 'pass'
434
+ end
435
+ end
436
+ end
437
+ end
438
+ expect( formatter.legacy_messages ).to eq [
439
+ :before_features,
440
+ :before_feature,
441
+ :before_tags,
442
+ :after_tags,
443
+ :feature_name,
444
+ :before_background,
445
+ :background_name,
446
+ :before_steps,
447
+ :before_step,
448
+ :before_step_result,
449
+ :step_name,
450
+ :after_step_result,
451
+ :after_step,
452
+ :after_steps,
453
+ :after_background,
454
+ :before_feature_element,
455
+ :before_tags,
456
+ :after_tags,
457
+ :scenario_name,
458
+ :before_steps,
459
+ :before_step,
460
+ :before_step_result,
461
+ :step_name,
462
+ :after_step_result,
463
+ :after_step,
464
+ :after_steps,
465
+ :after_feature_element,
466
+ :before_feature_element,
467
+ :before_tags,
468
+ :after_tags,
469
+ :scenario_name,
470
+ :before_steps,
471
+ :before_step,
472
+ :before_step_result,
473
+ :step_name,
474
+ :after_step_result,
475
+ :after_step,
476
+ :after_steps,
477
+ :before_examples_array,
478
+ :before_examples,
479
+ :before_tags,
480
+ :after_tags,
481
+ :examples_name,
482
+ :before_outline_table,
483
+ :before_table_row,
484
+ :before_table_cell,
485
+ :table_cell_value,
486
+ :after_table_cell,
487
+ :after_table_row,
488
+ :before_table_row,
489
+ :before_table_cell,
490
+ :table_cell_value,
491
+ :after_table_cell,
492
+ :after_table_row,
493
+ :after_outline_table,
494
+ :after_examples,
495
+ :after_examples_array,
496
+ :after_feature_element,
497
+ :after_feature,
498
+ :after_features,
499
+ ]
500
+ end
501
+
502
+ it 'a feature with a background and one scenario outline and one scenario' do
503
+ execute_gherkin do
504
+ feature do
505
+ background do
506
+ step 'passing'
507
+ end
508
+ scenario_outline do
509
+ step '<result>ing'
510
+ examples do
511
+ row 'result'
512
+ row 'pass'
513
+ end
514
+ end
515
+ scenario do
516
+ step 'passing'
517
+ end
518
+ end
519
+ end
520
+ expect( formatter.legacy_messages ).to eq [
521
+ :before_features,
522
+ :before_feature,
523
+ :before_tags,
524
+ :after_tags,
525
+ :feature_name,
526
+ :before_background,
527
+ :background_name,
528
+ :before_steps,
529
+ :before_step,
530
+ :before_step_result,
531
+ :step_name,
532
+ :after_step_result,
533
+ :after_step,
534
+ :after_steps,
535
+ :after_background,
536
+ :before_feature_element,
537
+ :before_tags,
538
+ :after_tags,
539
+ :scenario_name,
540
+ :before_steps,
541
+ :before_step,
542
+ :before_step_result,
543
+ :step_name,
544
+ :after_step_result,
545
+ :after_step,
546
+ :after_steps,
547
+ :before_examples_array,
548
+ :before_examples,
549
+ :before_tags,
550
+ :after_tags,
551
+ :examples_name,
552
+ :before_outline_table,
553
+ :before_table_row,
554
+ :before_table_cell,
555
+ :table_cell_value,
556
+ :after_table_cell,
557
+ :after_table_row,
558
+ :before_table_row,
559
+ :before_table_cell,
560
+ :table_cell_value,
561
+ :after_table_cell,
562
+ :after_table_row,
563
+ :after_outline_table,
564
+ :after_examples,
565
+ :after_examples_array,
566
+ :after_feature_element,
567
+ :before_feature_element,
568
+ :before_tags,
569
+ :after_tags,
570
+ :scenario_name,
571
+ :before_steps,
572
+ :before_step,
573
+ :before_step_result,
574
+ :step_name,
575
+ :after_step_result,
576
+ :after_step,
577
+ :after_steps,
578
+ :after_feature_element,
579
+ :after_feature,
580
+ :after_features,
581
+ ]
582
+ end
583
+
584
+ it 'a feature with a background and two scenario outlines' do
585
+ execute_gherkin do
586
+ feature do
587
+ background do
588
+ step 'passing'
589
+ end
590
+ scenario_outline do
591
+ step '<result>ing'
592
+ examples do
593
+ row 'result'
594
+ row 'pass'
595
+ end
596
+ end
597
+ scenario_outline do
598
+ step '<result>ing'
599
+ examples do
600
+ row 'result'
601
+ row 'pass'
602
+ end
603
+ end
604
+ end
605
+ end
606
+ expect( formatter.legacy_messages ).to eq [
607
+ :before_features,
608
+ :before_feature,
609
+ :before_tags,
610
+ :after_tags,
611
+ :feature_name,
612
+ :before_background,
613
+ :background_name,
614
+ :before_steps,
615
+ :before_step,
616
+ :before_step_result,
617
+ :step_name,
618
+ :after_step_result,
619
+ :after_step,
620
+ :after_steps,
621
+ :after_background,
622
+ :before_feature_element,
623
+ :before_tags,
624
+ :after_tags,
625
+ :scenario_name,
626
+ :before_steps,
627
+ :before_step,
628
+ :before_step_result,
629
+ :step_name,
630
+ :after_step_result,
631
+ :after_step,
632
+ :after_steps,
633
+ :before_examples_array,
634
+ :before_examples,
635
+ :before_tags,
636
+ :after_tags,
637
+ :examples_name,
638
+ :before_outline_table,
639
+ :before_table_row,
640
+ :before_table_cell,
641
+ :table_cell_value,
642
+ :after_table_cell,
643
+ :after_table_row,
644
+ :before_table_row,
645
+ :before_table_cell,
646
+ :table_cell_value,
647
+ :after_table_cell,
648
+ :after_table_row,
649
+ :after_outline_table,
650
+ :after_examples,
651
+ :after_examples_array,
652
+ :after_feature_element,
653
+ :before_feature_element,
654
+ :before_tags,
655
+ :after_tags,
656
+ :scenario_name,
657
+ :before_steps,
658
+ :before_step,
659
+ :before_step_result,
660
+ :step_name,
661
+ :after_step_result,
662
+ :after_step,
663
+ :after_steps,
664
+ :before_examples_array,
665
+ :before_examples,
666
+ :before_tags,
667
+ :after_tags,
668
+ :examples_name,
669
+ :before_outline_table,
670
+ :before_table_row,
671
+ :before_table_cell,
672
+ :table_cell_value,
673
+ :after_table_cell,
674
+ :after_table_row,
675
+ :before_table_row,
676
+ :before_table_cell,
677
+ :table_cell_value,
678
+ :after_table_cell,
679
+ :after_table_row,
680
+ :after_outline_table,
681
+ :after_examples,
682
+ :after_examples_array,
683
+ :after_feature_element,
684
+ :after_feature,
685
+ :after_features,
686
+ ]
687
+ end
688
+
689
+ it 'a feature with a background and one scenario outline with two rows' do
690
+ execute_gherkin do
691
+ feature do
692
+ background do
693
+ step 'passing'
694
+ end
695
+ scenario_outline do
696
+ step '<result>ing'
697
+ examples do
698
+ row 'result'
699
+ row 'pass'
700
+ row 'pass'
701
+ end
702
+ end
703
+ end
704
+ end
705
+ expect( formatter.legacy_messages ).to eq [
706
+ :before_features,
707
+ :before_feature,
708
+ :before_tags,
709
+ :after_tags,
710
+ :feature_name,
711
+ :before_background,
712
+ :background_name,
713
+ :before_steps,
714
+ :before_step,
715
+ :before_step_result,
716
+ :step_name,
717
+ :after_step_result,
718
+ :after_step,
719
+ :after_steps,
720
+ :after_background,
721
+ :before_feature_element,
722
+ :before_tags,
723
+ :after_tags,
724
+ :scenario_name,
725
+ :before_steps,
726
+ :before_step,
727
+ :before_step_result,
728
+ :step_name,
729
+ :after_step_result,
730
+ :after_step,
731
+ :after_steps,
732
+ :before_examples_array,
733
+ :before_examples,
734
+ :before_tags,
735
+ :after_tags,
736
+ :examples_name,
737
+ :before_outline_table,
738
+ :before_table_row,
739
+ :before_table_cell,
740
+ :table_cell_value,
741
+ :after_table_cell,
742
+ :after_table_row,
743
+ :before_table_row,
744
+ :before_table_cell,
745
+ :table_cell_value,
746
+ :after_table_cell,
747
+ :after_table_row,
748
+ :before_table_row,
749
+ :before_table_cell,
750
+ :table_cell_value,
751
+ :after_table_cell,
752
+ :after_table_row,
753
+ :after_outline_table,
754
+ :after_examples,
755
+ :after_examples_array,
756
+ :after_feature_element,
757
+ :after_feature,
758
+ :after_features,
759
+ ]
760
+ end
761
+
762
+ it 'a feature with a background and one scenario outline with two examples tables' do
763
+ execute_gherkin do
764
+ feature do
765
+ background do
766
+ step 'passing'
767
+ end
768
+ scenario_outline do
769
+ step '<result>ing'
770
+ examples do
771
+ row 'result'
772
+ row 'pass'
773
+ end
774
+ examples do
775
+ row 'result'
776
+ row 'pass'
777
+ end
778
+ end
779
+ end
780
+ end
781
+ expect( formatter.legacy_messages ).to eq [
782
+ :before_features,
783
+ :before_feature,
784
+ :before_tags,
785
+ :after_tags,
786
+ :feature_name,
787
+ :before_background,
788
+ :background_name,
789
+ :before_steps,
790
+ :before_step,
791
+ :before_step_result,
792
+ :step_name,
793
+ :after_step_result,
794
+ :after_step,
795
+ :after_steps,
796
+ :after_background,
797
+ :before_feature_element,
798
+ :before_tags,
799
+ :after_tags,
800
+ :scenario_name,
801
+ :before_steps,
802
+ :before_step,
803
+ :before_step_result,
804
+ :step_name,
805
+ :after_step_result,
806
+ :after_step,
807
+ :after_steps,
808
+ :before_examples_array,
809
+ :before_examples,
810
+ :before_tags,
811
+ :after_tags,
812
+ :examples_name,
813
+ :before_outline_table,
814
+ :before_table_row,
815
+ :before_table_cell,
816
+ :table_cell_value,
817
+ :after_table_cell,
818
+ :after_table_row,
819
+ :before_table_row,
820
+ :before_table_cell,
821
+ :table_cell_value,
822
+ :after_table_cell,
823
+ :after_table_row,
824
+ :after_outline_table,
825
+ :after_examples,
826
+ :before_examples,
827
+ :before_tags,
828
+ :after_tags,
829
+ :examples_name,
830
+ :before_outline_table,
831
+ :before_table_row,
832
+ :before_table_cell,
833
+ :table_cell_value,
834
+ :after_table_cell,
835
+ :after_table_row,
836
+ :before_table_row,
837
+ :before_table_cell,
838
+ :table_cell_value,
839
+ :after_table_cell,
840
+ :after_table_row,
841
+ :after_outline_table,
842
+ :after_examples,
843
+ :after_examples_array,
844
+ :after_feature_element,
845
+ :after_feature,
846
+ :after_features,
847
+ ]
848
+ end
849
+
850
+ it 'a feature with a background with two steps' do
851
+ execute_gherkin do
852
+ feature do
853
+ background do
854
+ step 'passing'
855
+ step 'passing'
856
+ end
857
+ scenario do
858
+ step 'passing'
859
+ end
860
+ end
861
+ end
862
+ expect( formatter.legacy_messages ).to eq [
863
+ :before_features,
864
+ :before_feature,
865
+ :before_tags,
866
+ :after_tags,
867
+ :feature_name,
868
+ :before_background,
869
+ :background_name,
870
+ :before_steps,
871
+ :before_step,
872
+ :before_step_result,
873
+ :step_name,
874
+ :after_step_result,
875
+ :after_step,
876
+ :before_step,
877
+ :before_step_result,
878
+ :step_name,
879
+ :after_step_result,
880
+ :after_step,
881
+ :after_steps,
882
+ :after_background,
883
+ :before_feature_element,
884
+ :before_tags,
885
+ :after_tags,
886
+ :scenario_name,
887
+ :before_steps,
888
+ :before_step,
889
+ :before_step_result,
890
+ :step_name,
891
+ :after_step_result,
892
+ :after_step,
893
+ :after_steps,
894
+ :after_feature_element,
895
+ :after_feature,
896
+ :after_features,
897
+ ]
898
+ end
899
+
900
+ it 'a feature with a background' do
901
+ execute_gherkin do
902
+ feature do
903
+ background do
904
+ step 'passing'
905
+ end
906
+ scenario do
907
+ step 'passing'
908
+ end
909
+ end
910
+ end
911
+ expect( formatter.legacy_messages ).to eq [
912
+ :before_features,
913
+ :before_feature,
914
+ :before_tags,
915
+ :after_tags,
916
+ :feature_name,
917
+ :before_background,
918
+ :background_name,
919
+ :before_steps,
920
+ :before_step,
921
+ :before_step_result,
922
+ :step_name,
923
+ :after_step_result,
924
+ :after_step,
925
+ :after_steps,
926
+ :after_background,
927
+ :before_feature_element,
928
+ :before_tags,
929
+ :after_tags,
930
+ :scenario_name,
931
+ :before_steps,
932
+ :before_step,
933
+ :before_step_result,
934
+ :step_name,
935
+ :after_step_result,
936
+ :after_step,
937
+ :after_steps,
938
+ :after_feature_element,
939
+ :after_feature,
940
+ :after_features,
941
+ ]
942
+ end
943
+
944
+ it 'scenario outline' do
945
+ execute_gherkin do
946
+ feature do
947
+ scenario_outline do
948
+ step '<result>ing'
949
+ examples do
950
+ row 'result'
951
+ row 'pass'
952
+ end
953
+ end
954
+ end
955
+ end
956
+ expect( formatter.legacy_messages ).to eq [
957
+ :before_features,
958
+ :before_feature,
959
+ :before_tags,
960
+ :after_tags,
961
+ :feature_name,
962
+ :before_feature_element,
963
+ :before_tags,
964
+ :after_tags,
965
+ :scenario_name,
966
+ :before_steps,
967
+ :before_step,
968
+ :before_step_result,
969
+ :step_name,
970
+ :after_step_result,
971
+ :after_step,
972
+ :after_steps,
973
+ :before_examples_array,
974
+ :before_examples,
975
+ :before_tags,
976
+ :after_tags,
977
+ :examples_name,
978
+ :before_outline_table,
979
+ :before_table_row,
980
+ :before_table_cell,
981
+ :table_cell_value,
982
+ :after_table_cell,
983
+ :after_table_row,
984
+ :before_table_row,
985
+ :before_table_cell,
986
+ :table_cell_value,
987
+ :after_table_cell,
988
+ :after_table_row,
989
+ :after_outline_table,
990
+ :after_examples,
991
+ :after_examples_array,
992
+ :after_feature_element,
993
+ :after_feature,
994
+ :after_features,
995
+ ]
996
+ end
997
+
998
+ it 'scenario outline after scenario' do
999
+ execute_gherkin do
1000
+ feature do
1001
+ scenario do
1002
+ step 'passing'
1003
+ end
1004
+ scenario_outline do
1005
+ step '<result>ing'
1006
+ examples do
1007
+ row 'result'
1008
+ row 'pass'
1009
+ end
1010
+ end
1011
+ end
1012
+ end
1013
+ expect( formatter.legacy_messages ).to eq [
1014
+ :before_features,
1015
+ :before_feature,
1016
+ :before_tags,
1017
+ :after_tags,
1018
+ :feature_name,
1019
+ :before_feature_element,
1020
+ :before_tags,
1021
+ :after_tags,
1022
+ :scenario_name,
1023
+ :before_steps,
1024
+ :before_step,
1025
+ :before_step_result,
1026
+ :step_name,
1027
+ :after_step_result,
1028
+ :after_step,
1029
+ :after_steps,
1030
+ :after_feature_element,
1031
+ :before_feature_element,
1032
+ :before_tags,
1033
+ :after_tags,
1034
+ :scenario_name,
1035
+ :before_steps,
1036
+ :before_step,
1037
+ :before_step_result,
1038
+ :step_name,
1039
+ :after_step_result,
1040
+ :after_step,
1041
+ :after_steps,
1042
+ :before_examples_array,
1043
+ :before_examples,
1044
+ :before_tags,
1045
+ :after_tags,
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
+ :after_outline_table,
1059
+ :after_examples,
1060
+ :after_examples_array,
1061
+ :after_feature_element,
1062
+ :after_feature,
1063
+ :after_features,
1064
+ ]
1065
+ end
1066
+
1067
+ it 'scenario outline before scenario' do
1068
+ execute_gherkin do
1069
+ feature do
1070
+ scenario_outline do
1071
+ step '<result>ing'
1072
+ examples do
1073
+ row 'result'
1074
+ row 'pass'
1075
+ end
1076
+ end
1077
+ scenario do
1078
+ step 'passing'
1079
+ end
1080
+ end
1081
+ end
1082
+ expect( formatter.legacy_messages ).to eq [
1083
+ :before_features,
1084
+ :before_feature,
1085
+ :before_tags,
1086
+ :after_tags,
1087
+ :feature_name,
1088
+ :before_feature_element,
1089
+ :before_tags,
1090
+ :after_tags,
1091
+ :scenario_name,
1092
+ :before_steps,
1093
+ :before_step,
1094
+ :before_step_result,
1095
+ :step_name,
1096
+ :after_step_result,
1097
+ :after_step,
1098
+ :after_steps,
1099
+ :before_examples_array,
1100
+ :before_examples,
1101
+ :before_tags,
1102
+ :after_tags,
1103
+ :examples_name,
1104
+ :before_outline_table,
1105
+ :before_table_row,
1106
+ :before_table_cell,
1107
+ :table_cell_value,
1108
+ :after_table_cell,
1109
+ :after_table_row,
1110
+ :before_table_row,
1111
+ :before_table_cell,
1112
+ :table_cell_value,
1113
+ :after_table_cell,
1114
+ :after_table_row,
1115
+ :after_outline_table,
1116
+ :after_examples,
1117
+ :after_examples_array,
1118
+ :after_feature_element,
1119
+ :before_feature_element,
1120
+ :before_tags,
1121
+ :after_tags,
1122
+ :scenario_name,
1123
+ :before_steps,
1124
+ :before_step,
1125
+ :before_step_result,
1126
+ :step_name,
1127
+ :after_step_result,
1128
+ :after_step,
1129
+ :after_steps,
1130
+ :after_feature_element,
1131
+ :after_feature,
1132
+ :after_features,
1133
+ ]
1134
+ end
1135
+
1136
+ it 'scenario outline two rows' do
1137
+ execute_gherkin do
1138
+ feature do
1139
+ scenario_outline do
1140
+ step '<result>ing'
1141
+ examples do
1142
+ row 'result'
1143
+ row 'pass'
1144
+ row 'pass'
1145
+ end
1146
+ end
1147
+ end
1148
+ end
1149
+ expect( formatter.legacy_messages ).to eq [
1150
+ :before_features,
1151
+ :before_feature,
1152
+ :before_tags,
1153
+ :after_tags,
1154
+ :feature_name,
1155
+ :before_feature_element,
1156
+ :before_tags,
1157
+ :after_tags,
1158
+ :scenario_name,
1159
+ :before_steps,
1160
+ :before_step,
1161
+ :before_step_result,
1162
+ :step_name,
1163
+ :after_step_result,
1164
+ :after_step,
1165
+ :after_steps,
1166
+ :before_examples_array,
1167
+ :before_examples,
1168
+ :before_tags,
1169
+ :after_tags,
1170
+ :examples_name,
1171
+ :before_outline_table,
1172
+ :before_table_row,
1173
+ :before_table_cell,
1174
+ :table_cell_value,
1175
+ :after_table_cell,
1176
+ :after_table_row,
1177
+ :before_table_row,
1178
+ :before_table_cell,
1179
+ :table_cell_value,
1180
+ :after_table_cell,
1181
+ :after_table_row,
1182
+ :before_table_row,
1183
+ :before_table_cell,
1184
+ :table_cell_value,
1185
+ :after_table_cell,
1186
+ :after_table_row,
1187
+ :after_outline_table,
1188
+ :after_examples,
1189
+ :after_examples_array,
1190
+ :after_feature_element,
1191
+ :after_feature,
1192
+ :after_features,
1193
+ ]
1194
+ end
1195
+
1196
+ it 'scenario outline two examples tables' do
1197
+ execute_gherkin do
1198
+ feature do
1199
+ scenario_outline do
1200
+ step '<result>ing'
1201
+ examples do
1202
+ row 'result'
1203
+ row 'pass'
1204
+ end
1205
+ examples do
1206
+ row 'result'
1207
+ row 'pass'
1208
+ end
1209
+ end
1210
+ end
1211
+ end
1212
+ expect( formatter.legacy_messages ).to eq [
1213
+ :before_features,
1214
+ :before_feature,
1215
+ :before_tags,
1216
+ :after_tags,
1217
+ :feature_name,
1218
+ :before_feature_element,
1219
+ :before_tags,
1220
+ :after_tags,
1221
+ :scenario_name,
1222
+ :before_steps,
1223
+ :before_step,
1224
+ :before_step_result,
1225
+ :step_name,
1226
+ :after_step_result,
1227
+ :after_step,
1228
+ :after_steps,
1229
+ :before_examples_array,
1230
+ :before_examples,
1231
+ :before_tags,
1232
+ :after_tags,
1233
+ :examples_name,
1234
+ :before_outline_table,
1235
+ :before_table_row,
1236
+ :before_table_cell,
1237
+ :table_cell_value,
1238
+ :after_table_cell,
1239
+ :after_table_row,
1240
+ :before_table_row,
1241
+ :before_table_cell,
1242
+ :table_cell_value,
1243
+ :after_table_cell,
1244
+ :after_table_row,
1245
+ :after_outline_table,
1246
+ :after_examples,
1247
+ :before_examples,
1248
+ :before_tags,
1249
+ :after_tags,
1250
+ :examples_name,
1251
+ :before_outline_table,
1252
+ :before_table_row,
1253
+ :before_table_cell,
1254
+ :table_cell_value,
1255
+ :after_table_cell,
1256
+ :after_table_row,
1257
+ :before_table_row,
1258
+ :before_table_cell,
1259
+ :table_cell_value,
1260
+ :after_table_cell,
1261
+ :after_table_row,
1262
+ :after_outline_table,
1263
+ :after_examples,
1264
+ :after_examples_array,
1265
+ :after_feature_element,
1266
+ :after_feature,
1267
+ :after_features,
1268
+ ]
1269
+ end
1270
+
1271
+ it 'two scenario outline' do
1272
+ execute_gherkin do
1273
+ feature do
1274
+ scenario_outline do
1275
+ step '<result>ing'
1276
+ examples do
1277
+ row 'result'
1278
+ row 'pass'
1279
+ end
1280
+ end
1281
+ scenario_outline do
1282
+ step '<result>ing'
1283
+ examples do
1284
+ row 'result'
1285
+ row 'pass'
1286
+ end
1287
+ end
1288
+ end
1289
+ end
1290
+ expect( formatter.legacy_messages ).to eq [
1291
+ :before_features,
1292
+ :before_feature,
1293
+ :before_tags,
1294
+ :after_tags,
1295
+ :feature_name,
1296
+ :before_feature_element,
1297
+ :before_tags,
1298
+ :after_tags,
1299
+ :scenario_name,
1300
+ :before_steps,
1301
+ :before_step,
1302
+ :before_step_result,
1303
+ :step_name,
1304
+ :after_step_result,
1305
+ :after_step,
1306
+ :after_steps,
1307
+ :before_examples_array,
1308
+ :before_examples,
1309
+ :before_tags,
1310
+ :after_tags,
1311
+ :examples_name,
1312
+ :before_outline_table,
1313
+ :before_table_row,
1314
+ :before_table_cell,
1315
+ :table_cell_value,
1316
+ :after_table_cell,
1317
+ :after_table_row,
1318
+ :before_table_row,
1319
+ :before_table_cell,
1320
+ :table_cell_value,
1321
+ :after_table_cell,
1322
+ :after_table_row,
1323
+ :after_outline_table,
1324
+ :after_examples,
1325
+ :after_examples_array,
1326
+ :after_feature_element,
1327
+ :before_feature_element,
1328
+ :before_tags,
1329
+ :after_tags,
1330
+ :scenario_name,
1331
+ :before_steps,
1332
+ :before_step,
1333
+ :before_step_result,
1334
+ :step_name,
1335
+ :after_step_result,
1336
+ :after_step,
1337
+ :after_steps,
1338
+ :before_examples_array,
1339
+ :before_examples,
1340
+ :before_tags,
1341
+ :after_tags,
1342
+ :examples_name,
1343
+ :before_outline_table,
1344
+ :before_table_row,
1345
+ :before_table_cell,
1346
+ :table_cell_value,
1347
+ :after_table_cell,
1348
+ :after_table_row,
1349
+ :before_table_row,
1350
+ :before_table_cell,
1351
+ :table_cell_value,
1352
+ :after_table_cell,
1353
+ :after_table_row,
1354
+ :after_outline_table,
1355
+ :after_examples,
1356
+ :after_examples_array,
1357
+ :after_feature_element,
1358
+ :after_feature,
1359
+ :after_features,
1360
+ ]
1361
+ end
1362
+
1363
+ it 'failing scenario outline' do
1364
+ execute_gherkin do
1365
+ feature do
1366
+ scenario_outline do
1367
+ step '<result>ing'
1368
+ examples do
1369
+ row 'result'
1370
+ row 'fail'
1371
+ end
1372
+ end
1373
+ end
1374
+ end
1375
+ expect( formatter.legacy_messages ).to eq [
1376
+ :before_features,
1377
+ :before_feature,
1378
+ :before_tags,
1379
+ :after_tags,
1380
+ :feature_name,
1381
+ :before_feature_element,
1382
+ :before_tags,
1383
+ :after_tags,
1384
+ :scenario_name,
1385
+ :before_steps,
1386
+ :before_step,
1387
+ :before_step_result,
1388
+ :step_name,
1389
+ :after_step_result,
1390
+ :after_step,
1391
+ :after_steps,
1392
+ :before_examples_array,
1393
+ :before_examples,
1394
+ :before_tags,
1395
+ :after_tags,
1396
+ :examples_name,
1397
+ :before_outline_table,
1398
+ :before_table_row,
1399
+ :before_table_cell,
1400
+ :table_cell_value,
1401
+ :after_table_cell,
1402
+ :after_table_row,
1403
+ :before_table_row,
1404
+ :before_table_cell,
1405
+ :table_cell_value,
1406
+ :after_table_cell,
1407
+ :after_table_row,
1408
+ :after_outline_table,
1409
+ :after_examples,
1410
+ :after_examples_array,
1411
+ :after_feature_element,
1412
+ :after_feature,
1413
+ :after_features,
1414
+ ]
1415
+ end
1416
+
1417
+ it 'a feature with a failing background and two scenarios' do
1418
+ execute_gherkin do
1419
+ feature do
1420
+ background do
1421
+ step 'failing'
1422
+ end
1423
+ scenario do
1424
+ step 'passing'
1425
+ end
1426
+ scenario do
1427
+ step 'passing'
1428
+ end
1429
+ end
1430
+ end
1431
+ expect( formatter.legacy_messages ).to eq [
1432
+ :before_features,
1433
+ :before_feature,
1434
+ :before_tags,
1435
+ :after_tags,
1436
+ :feature_name,
1437
+ :before_background,
1438
+ :background_name,
1439
+ :before_steps,
1440
+ :before_step,
1441
+ :before_step_result,
1442
+ :step_name,
1443
+ :exception,
1444
+ :after_step_result,
1445
+ :after_step,
1446
+ :after_steps,
1447
+ :after_background,
1448
+ :before_feature_element,
1449
+ :before_tags,
1450
+ :after_tags,
1451
+ :scenario_name,
1452
+ :before_steps,
1453
+ :before_step,
1454
+ :before_step_result,
1455
+ :step_name,
1456
+ :after_step_result,
1457
+ :after_step,
1458
+ :after_steps,
1459
+ :after_feature_element,
1460
+ :before_feature_element,
1461
+ :before_tags,
1462
+ :after_tags,
1463
+ :scenario_name,
1464
+ :before_steps,
1465
+ :before_step,
1466
+ :before_step_result,
1467
+ :step_name,
1468
+ :after_step_result,
1469
+ :after_step,
1470
+ :after_steps,
1471
+ :after_feature_element,
1472
+ :after_feature,
1473
+ :after_features,
1474
+ ]
1475
+ end
1476
+
1477
+ context 'in expand mode' do
1478
+ let(:runtime) { Runtime.new expand: true }
1479
+ let(:formatter) { MessageSpy.new }
1480
+
1481
+ it 'scenario outline two rows' do
1482
+ execute_gherkin do
1483
+ feature do
1484
+ scenario_outline do
1485
+ step '<result>ing'
1486
+ examples do
1487
+ row 'result'
1488
+ row 'pass'
1489
+ row 'pass'
1490
+ end
1491
+ end
1492
+ end
1493
+ end
1494
+ expect( formatter.legacy_messages ).to eq [
1495
+ :before_features,
1496
+ :before_feature,
1497
+ :before_tags,
1498
+ :after_tags,
1499
+ :feature_name,
1500
+ :before_feature_element,
1501
+ :before_tags,
1502
+ :after_tags,
1503
+ :scenario_name,
1504
+ :before_steps,
1505
+ :before_step,
1506
+ :before_step_result,
1507
+ :step_name,
1508
+ :after_step_result,
1509
+ :after_step,
1510
+ :after_steps,
1511
+ :before_examples_array,
1512
+ :before_examples,
1513
+ :before_tags,
1514
+ :after_tags,
1515
+ :examples_name,
1516
+ :before_outline_table,
1517
+ :scenario_name,
1518
+ :before_step,
1519
+ :before_step_result,
1520
+ :step_name,
1521
+ :after_step_result,
1522
+ :after_step,
1523
+ :scenario_name,
1524
+ :before_step,
1525
+ :before_step_result,
1526
+ :step_name,
1527
+ :after_step_result,
1528
+ :after_step,
1529
+ :after_outline_table,
1530
+ :after_examples,
1531
+ :after_examples_array,
1532
+ :after_feature_element,
1533
+ :after_feature,
1534
+ :after_features,
1535
+ ]
1536
+ end
1537
+ end
1538
+
1539
+ context 'with exception in after step hook' do
1540
+
1541
+ class FailingAfterStepHook
1542
+ def find_after_step_hooks(test_case)
1543
+ failing_hook = HookWrapper.new(proc { raise Failure })
1544
+ Runtime::StepHooks.new [failing_hook]
1545
+ end
1546
+ end
1547
+
1548
+ it 'prints the exception within the step' do
1549
+ filters = [
1550
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1551
+ Filters::ApplyAfterStepHooks.new(FailingAfterStepHook.new),
1552
+ AddBeforeAndAfterHooks.new
1553
+ ]
1554
+ execute_gherkin(filters) do
1555
+ feature do
1556
+ scenario do
1557
+ step 'passing'
1558
+ end
1559
+ end
1560
+ end
1561
+ expect( formatter.legacy_messages ).to eq([
1562
+ :before_features,
1563
+ :before_feature,
1564
+ :before_tags,
1565
+ :after_tags,
1566
+ :feature_name,
1567
+ :before_feature_element,
1568
+ :before_tags,
1569
+ :after_tags,
1570
+ :scenario_name,
1571
+ :before_steps,
1572
+ :before_step,
1573
+ :before_step_result,
1574
+ :step_name,
1575
+ :after_step_result,
1576
+ :after_step,
1577
+ :exception,
1578
+ :after_steps,
1579
+ :after_feature_element,
1580
+ :after_feature,
1581
+ :after_features,
1582
+ ])
1583
+ end
1584
+ end
1585
+
1586
+ context 'with exception in a single before hook' do
1587
+ class FailingBeforeHook
1588
+ def apply_before_hooks(test_case)
1589
+ failing_hook = HookWrapper.new(proc { raise Failure })
1590
+ Runtime::BeforeHooks.new([failing_hook], RunningTestCase.new(test_case)).apply_to(test_case)
1591
+ end
1592
+ end
1593
+
1594
+ it 'prints the exception after the scenario name' do
1595
+ filters = [
1596
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1597
+ Filters::ApplyBeforeHooks.new(FailingBeforeHook.new),
1598
+ AddBeforeAndAfterHooks.new
1599
+ ]
1600
+ execute_gherkin(filters) do
1601
+ feature do
1602
+ scenario do
1603
+ step 'passing'
1604
+ end
1605
+ end
1606
+ end
1607
+
1608
+ expect( formatter.legacy_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
+ :exception,
1619
+ :before_steps,
1620
+ :before_step,
1621
+ :before_step_result,
1622
+ :step_name,
1623
+ :after_step_result,
1624
+ :after_step,
1625
+ :after_steps,
1626
+ :after_feature_element,
1627
+ :after_feature,
1628
+ :after_features,
1629
+ ])
1630
+ end
1631
+
1632
+ it 'prints the exception after the background name' do
1633
+ filters = [
1634
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1635
+ Filters::ApplyBeforeHooks.new(FailingBeforeHook.new),
1636
+ AddBeforeAndAfterHooks.new
1637
+ ]
1638
+ execute_gherkin(filters) do
1639
+ feature do
1640
+ background do
1641
+ step 'passing'
1642
+ end
1643
+ scenario do
1644
+ step 'passing'
1645
+ end
1646
+ end
1647
+ end
1648
+
1649
+ expect( formatter.legacy_messages ).to eq([
1650
+ :before_features,
1651
+ :before_feature,
1652
+ :before_tags,
1653
+ :after_tags,
1654
+ :feature_name,
1655
+ :before_background,
1656
+ :background_name,
1657
+ :exception,
1658
+ :before_steps,
1659
+ :before_step,
1660
+ :before_step_result,
1661
+ :step_name,
1662
+ :after_step_result,
1663
+ :after_step,
1664
+ :after_steps,
1665
+ :after_background,
1666
+ :before_feature_element,
1667
+ :before_tags,
1668
+ :after_tags,
1669
+ :scenario_name,
1670
+ :before_steps,
1671
+ :before_step,
1672
+ :before_step_result,
1673
+ :step_name,
1674
+ :after_step_result,
1675
+ :after_step,
1676
+ :after_steps,
1677
+ :after_feature_element,
1678
+ :after_feature,
1679
+ :after_features,
1680
+ ])
1681
+ end
1682
+
1683
+
1684
+ it 'prints the exception before the examples table row' do
1685
+ filters = [
1686
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1687
+ Filters::ApplyBeforeHooks.new(FailingBeforeHook.new),
1688
+ AddBeforeAndAfterHooks.new
1689
+ ]
1690
+ execute_gherkin(filters) do
1691
+ feature do
1692
+ scenario_outline do
1693
+ step '<status>ing'
1694
+ examples do
1695
+ row 'status'
1696
+ row 'pass'
1697
+ end
1698
+ end
1699
+ end
1700
+ end
1701
+
1702
+ expect( formatter.legacy_messages ).to eq([
1703
+ :before_features,
1704
+ :before_feature,
1705
+ :before_tags,
1706
+ :after_tags,
1707
+ :feature_name,
1708
+ :before_feature_element,
1709
+ :before_tags,
1710
+ :after_tags,
1711
+ :scenario_name,
1712
+ :before_steps,
1713
+ :before_step,
1714
+ :before_step_result,
1715
+ :step_name,
1716
+ :after_step_result,
1717
+ :after_step,
1718
+ :after_steps,
1719
+ :before_examples_array,
1720
+ :before_examples,
1721
+ :before_tags,
1722
+ :after_tags,
1723
+ :examples_name,
1724
+ :before_outline_table,
1725
+ :before_table_row,
1726
+ :before_table_cell,
1727
+ :table_cell_value,
1728
+ :after_table_cell,
1729
+ :after_table_row,
1730
+ :exception,
1731
+ :before_table_row,
1732
+ :before_table_cell,
1733
+ :table_cell_value,
1734
+ :after_table_cell,
1735
+ :after_table_row,
1736
+ :after_outline_table,
1737
+ :after_examples,
1738
+ :after_examples_array,
1739
+ :after_feature_element,
1740
+ :after_feature,
1741
+ :after_features,
1742
+ ])
1743
+ end
1744
+ end
1745
+
1746
+ context 'with exception in the first of several before hooks' do
1747
+ # This proves that the second before hook's result doesn't overwrite
1748
+ # the result of the first one.
1749
+ class FailingAndPassingBeforeHooks
1750
+ def apply_before_hooks(test_case)
1751
+ failing_hook = HookWrapper.new(proc { raise Failure })
1752
+ passing_hook = HookWrapper.new(proc {})
1753
+ Runtime::BeforeHooks.new([failing_hook, passing_hook], RunningTestCase.new(test_case)).apply_to(test_case)
1754
+ end
1755
+ end
1756
+
1757
+ it 'prints the exception after the scenario name' do
1758
+ filters = [
1759
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1760
+ Filters::ApplyBeforeHooks.new(FailingAndPassingBeforeHooks.new),
1761
+ AddBeforeAndAfterHooks.new
1762
+ ]
1763
+ execute_gherkin(filters) do
1764
+ feature do
1765
+ scenario do
1766
+ step 'passing'
1767
+ end
1768
+ end
1769
+ end
1770
+
1771
+ expect( formatter.legacy_messages ).to eq([
1772
+ :before_features,
1773
+ :before_feature,
1774
+ :before_tags,
1775
+ :after_tags,
1776
+ :feature_name,
1777
+ :before_feature_element,
1778
+ :before_tags,
1779
+ :after_tags,
1780
+ :scenario_name,
1781
+ :exception,
1782
+ :before_steps,
1783
+ :before_step,
1784
+ :before_step_result,
1785
+ :step_name,
1786
+ :after_step_result,
1787
+ :after_step,
1788
+ :after_steps,
1789
+ :after_feature_element,
1790
+ :after_feature,
1791
+ :after_features,
1792
+ ])
1793
+ end
1794
+ end
1795
+
1796
+ context 'with exception in after hooks' do
1797
+
1798
+ class FailingAfterHook
1799
+ def apply_after_hooks(test_case)
1800
+ failing_hook = HookWrapper.new(proc { raise Failure })
1801
+ Runtime::AfterHooks.new([failing_hook], RunningTestCase.new(test_case)).apply_to(test_case)
1802
+ end
1803
+ end
1804
+
1805
+ it 'prints the exception after the steps' do
1806
+ filters = [
1807
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1808
+ Filters::ApplyAfterHooks.new(FailingAfterHook.new),
1809
+ AddBeforeAndAfterHooks.new
1810
+ ]
1811
+ execute_gherkin(filters) do
1812
+ feature do
1813
+ scenario do
1814
+ step 'passing'
1815
+ end
1816
+ end
1817
+ end
1818
+
1819
+ expect( formatter.legacy_messages ).to eq([
1820
+ :before_features,
1821
+ :before_feature,
1822
+ :before_tags,
1823
+ :after_tags,
1824
+ :feature_name,
1825
+ :before_feature_element,
1826
+ :before_tags,
1827
+ :after_tags,
1828
+ :scenario_name,
1829
+ :before_steps,
1830
+ :before_step,
1831
+ :before_step_result,
1832
+ :step_name,
1833
+ :after_step_result,
1834
+ :after_step,
1835
+ :after_steps,
1836
+ :exception,
1837
+ :after_feature_element,
1838
+ :after_feature,
1839
+ :after_features,
1840
+ ])
1841
+ end
1842
+
1843
+ it 'prints the exception after the examples table row' do
1844
+ filters = [
1845
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1846
+ Filters::ApplyAfterHooks.new(FailingAfterHook.new),
1847
+ AddBeforeAndAfterHooks.new
1848
+ ]
1849
+ execute_gherkin(filters) do
1850
+ feature do
1851
+ scenario_outline do
1852
+ step '<status>ing'
1853
+ examples do
1854
+ row 'status'
1855
+ row 'pass'
1856
+ end
1857
+ end
1858
+ end
1859
+ end
1860
+
1861
+ expect( formatter.legacy_messages ).to eq([
1862
+ :before_features,
1863
+ :before_feature,
1864
+ :before_tags,
1865
+ :after_tags,
1866
+ :feature_name,
1867
+ :before_feature_element,
1868
+ :before_tags,
1869
+ :after_tags,
1870
+ :scenario_name,
1871
+ :before_steps,
1872
+ :before_step,
1873
+ :before_step_result,
1874
+ :step_name,
1875
+ :after_step_result,
1876
+ :after_step,
1877
+ :after_steps,
1878
+ :before_examples_array,
1879
+ :before_examples,
1880
+ :before_tags,
1881
+ :after_tags,
1882
+ :examples_name,
1883
+ :before_outline_table,
1884
+ :before_table_row,
1885
+ :before_table_cell,
1886
+ :table_cell_value,
1887
+ :after_table_cell,
1888
+ :after_table_row,
1889
+ :before_table_row,
1890
+ :before_table_cell,
1891
+ :table_cell_value,
1892
+ :after_table_cell,
1893
+ :after_table_row,
1894
+ :exception,
1895
+ :after_outline_table,
1896
+ :after_examples,
1897
+ :after_examples_array,
1898
+ :after_feature_element,
1899
+ :after_feature,
1900
+ :after_features,
1901
+ ])
1902
+ end
1903
+ end
1904
+
1905
+ context 'with exception in the first of several after hooks' do
1906
+ class FailingThenPassingAfterHooks
1907
+ def apply_after_hooks(test_case)
1908
+ failing_hook = HookWrapper.new(proc { raise Failure })
1909
+ passing_hook = HookWrapper.new(proc {})
1910
+ Runtime::AfterHooks.new([failing_hook, passing_hook], RunningTestCase.new(test_case)).apply_to(test_case)
1911
+ end
1912
+ end
1913
+
1914
+ it 'prints the exception after the steps' do
1915
+ filters = [
1916
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1917
+ Filters::ApplyAfterHooks.new(FailingThenPassingAfterHooks.new),
1918
+ AddBeforeAndAfterHooks.new
1919
+ ]
1920
+ execute_gherkin(filters) do
1921
+ feature do
1922
+ scenario do
1923
+ step 'passing'
1924
+ end
1925
+ end
1926
+ end
1927
+
1928
+ expect( formatter.legacy_messages ).to eq([
1929
+ :before_features,
1930
+ :before_feature,
1931
+ :before_tags,
1932
+ :after_tags,
1933
+ :feature_name,
1934
+ :before_feature_element,
1935
+ :before_tags,
1936
+ :after_tags,
1937
+ :scenario_name,
1938
+ :before_steps,
1939
+ :before_step,
1940
+ :before_step_result,
1941
+ :step_name,
1942
+ :after_step_result,
1943
+ :after_step,
1944
+ :after_steps,
1945
+ :exception,
1946
+ :after_feature_element,
1947
+ :after_feature,
1948
+ :after_features,
1949
+ ])
1950
+ end
1951
+ end
1952
+
1953
+ context 'with an exception in an after hook but no steps' do
1954
+ it 'prints the exception after the scenario name' do
1955
+ filters = [
1956
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1957
+ Filters::ApplyAfterHooks.new(FailingAfterHook.new),
1958
+ AddBeforeAndAfterHooks.new
1959
+ ]
1960
+ execute_gherkin(filters) do
1961
+ feature do
1962
+ scenario do
1963
+ end
1964
+ end
1965
+ end
1966
+
1967
+ expect( formatter.legacy_messages ).to eq([
1968
+ :before_features,
1969
+ :before_feature,
1970
+ :before_tags,
1971
+ :after_tags,
1972
+ :feature_name,
1973
+ :before_feature_element,
1974
+ :before_tags,
1975
+ :after_tags,
1976
+ :scenario_name,
1977
+ :exception,
1978
+ :after_feature_element,
1979
+ :after_feature,
1980
+ :after_features,
1981
+ ])
1982
+ end
1983
+ end
1984
+
1985
+ context 'with an exception in an around hook before the test case is run' do
1986
+ class FailingAroundHookBeforeRunningTestCase
1987
+ def find_around_hooks(test_case)
1988
+ [
1989
+ Hooks.around_hook(test_case.source) { raise Failure }
1990
+ ]
1991
+ end
1992
+ end
1993
+
1994
+ it 'prints the exception after the scenario name' do
1995
+ filters = [
1996
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
1997
+ Filters::ApplyAroundHooks.new(FailingAroundHookBeforeRunningTestCase.new),
1998
+ AddBeforeAndAfterHooks.new
1999
+ ]
2000
+ execute_gherkin(filters) do
2001
+ feature do
2002
+ scenario do
2003
+ end
2004
+ end
2005
+ end
2006
+
2007
+ expect( formatter.legacy_messages ).to eq([
2008
+ :before_features,
2009
+ :before_feature,
2010
+ :before_tags,
2011
+ :after_tags,
2012
+ :feature_name,
2013
+ :before_feature_element,
2014
+ :before_tags,
2015
+ :after_tags,
2016
+ :scenario_name,
2017
+ :exception,
2018
+ :after_feature_element,
2019
+ :after_feature,
2020
+ :after_features,
2021
+ ])
2022
+ end
2023
+ end
2024
+
2025
+ context 'with an exception in an around hook after the test case is run' do
2026
+ class FailingAroundHookAfterRunningTestCase
2027
+ def find_around_hooks(test_case)
2028
+ [
2029
+ Hooks.around_hook(test_case.source) { |run_test_case| run_test_case.call; raise Failure }
2030
+ ]
2031
+ end
2032
+ end
2033
+
2034
+ it 'prints the exception after the scenario name' do
2035
+ filters = [
2036
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
2037
+ Filters::ApplyAroundHooks.new(FailingAroundHookAfterRunningTestCase.new),
2038
+ AddBeforeAndAfterHooks.new
2039
+ ]
2040
+ execute_gherkin(filters) do
2041
+ feature do
2042
+ scenario do
2043
+ step
2044
+ end
2045
+ end
2046
+ end
2047
+
2048
+ expect( formatter.legacy_messages ).to eq([
2049
+ :before_features,
2050
+ :before_feature,
2051
+ :before_tags,
2052
+ :after_tags,
2053
+ :feature_name,
2054
+ :before_feature_element,
2055
+ :before_tags,
2056
+ :after_tags,
2057
+ :scenario_name,
2058
+ :before_steps,
2059
+ :before_step,
2060
+ :before_step_result,
2061
+ :step_name,
2062
+ :after_step_result,
2063
+ :after_step,
2064
+ :exception,
2065
+ :after_steps,
2066
+ :after_feature_element,
2067
+ :after_feature,
2068
+ :after_features,
2069
+ ])
2070
+ end
2071
+ end
2072
+ end
2073
+
2074
+ describe 'before_step_result message' do
2075
+ context 'when the step matches' do
2076
+ it "sends the step match to the formatter" do
2077
+ expect(formatter).to receive(:before_step_result) do |_, step_match, *|
2078
+ expect(step_match).to be_a SimpleStepMatch
2079
+ end
2080
+ execute_gherkin do
2081
+ feature do
2082
+ scenario do
2083
+ step 'passing'
2084
+ end
2085
+ end
2086
+ end
2087
+ end
2088
+ end
2089
+
2090
+ context "when the step doesn't match" do
2091
+ it "sends a null object to the formatter" do
2092
+ end
2093
+ end
2094
+ end
2095
+
2096
+ it 'passes nil as the multiline arg when there is none' do
2097
+ expect(formatter).to receive(:after_step_result) do |keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line|
2098
+ expect(multiline_arg).to be_nil
2099
+ end
2100
+ execute_gherkin do
2101
+ feature do
2102
+ scenario do
2103
+ step 'passing'
2104
+ end
2105
+ end
2106
+ end
2107
+ end
2108
+
2109
+ context "after_feature_element callback" do
2110
+ it 'passes an object reflecting the status of the scenario' do
2111
+ expect( formatter ).to receive(:after_feature_element).once do |scenario|
2112
+ expect( scenario ).to be_failed
2113
+ end
2114
+ execute_gherkin do
2115
+ feature do
2116
+ scenario do
2117
+ step 'failing'
2118
+ step 'this will be skipped'
2119
+ end
2120
+ end
2121
+ end
2122
+ end
2123
+ end
2124
+
2125
+ context 'in strict mode' do
2126
+ let(:runtime) { Runtime.new strict: true }
2127
+
2128
+ it 'passes an exception to the formatter for undefined steps' do
2129
+ expect( formatter ).to receive(:exception) do |exception|
2130
+ expect( exception.message ).to eq %{Undefined step: "this step is undefined"}
2131
+ end
2132
+ execute_gherkin do
2133
+ feature do
2134
+ scenario do
2135
+ step 'this step is undefined'
2136
+ end
2137
+ end
2138
+ end
2139
+ end
2140
+ end
2141
+
2142
+ class MessageSpy
2143
+ attr_reader :messages
2144
+
2145
+ def initialize
2146
+ @messages = []
2147
+ end
2148
+
2149
+ def legacy_messages
2150
+ @messages - [
2151
+ :before_test_step,
2152
+ :before_test_case,
2153
+ :after_test_step,
2154
+ :after_test_case,
2155
+ :done
2156
+ ]
2157
+ end
2158
+
2159
+ def method_missing(message, *args)
2160
+ @messages << message
2161
+ end
2162
+
2163
+ def respond_to_missing?(name, include_private = false)
2164
+ true
2165
+ end
2166
+ end
2167
+
2168
+ def execute_gherkin(filters = default_filters, &gherkin)
2169
+ runner = Core::Test::Runner.new(report)
2170
+ compile [gherkin(&gherkin)], runner, filters
2171
+ end
2172
+
2173
+ def default_filters
2174
+ [
2175
+ Filters::ActivateSteps.new(step_match_search, runtime.configuration),
2176
+ AddBeforeAndAfterHooks.new
2177
+ ]
2178
+ end
2179
+
2180
+ end
2181
+ end
2182
+ end