cucumber 2.0.0.rc.5 → 4.0.0.rc.3

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