cucumber 3.0.0.pre.1 → 4.0.0.rc.4

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