cucumber 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -3
  3. data/CONTRIBUTING.md +2 -4
  4. data/README.md +6 -5
  5. data/lib/cucumber/cli/options.rb +3 -1
  6. data/lib/cucumber/errors.rb +1 -1
  7. data/lib/cucumber/events/test_step_finished.rb +0 -2
  8. data/lib/cucumber/events/test_step_started.rb +0 -2
  9. data/lib/cucumber/events.rb +0 -1
  10. data/lib/cucumber/filters/quit.rb +0 -1
  11. data/lib/cucumber/formatter/html.rb +1 -1
  12. data/lib/cucumber/formatter/html_builder.rb +1 -1
  13. data/lib/cucumber/formatter/ignore_missing_messages.rb +0 -1
  14. data/lib/cucumber/formatter/json.rb +1 -1
  15. data/lib/cucumber/formatter/json_pretty.rb +0 -1
  16. data/lib/cucumber/formatter/junit.rb +6 -2
  17. data/lib/cucumber/formatter/rerun.rb +1 -1
  18. data/lib/cucumber/formatter/summary.rb +0 -1
  19. data/lib/cucumber/glue/dsl.rb +6 -2
  20. data/lib/cucumber/glue/proto_world.rb +2 -0
  21. data/lib/cucumber/glue/step_definition.rb +1 -1
  22. data/lib/cucumber/glue/world_factory.rb +1 -1
  23. data/lib/cucumber/hooks.rb +12 -0
  24. data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +0 -1
  25. data/lib/cucumber/multiline_argument/data_table.rb +6 -10
  26. data/lib/cucumber/multiline_argument.rb +1 -1
  27. data/lib/cucumber/step_definitions.rb +1 -1
  28. data/lib/cucumber/step_match.rb +4 -1
  29. data/lib/cucumber/step_match_search.rb +1 -1
  30. data/lib/cucumber/version +1 -1
  31. metadata +32 -571
  32. data/.coveralls.yml +0 -1
  33. data/.cucumberproignore +0 -6
  34. data/.gitattributes +0 -32
  35. data/.github/ISSUE_TEMPLATE.md +0 -48
  36. data/.github/PULL_REQUEST_TEMPLATE.md +0 -40
  37. data/.rspec +0 -1
  38. data/.rubocop.yml +0 -13
  39. data/.rubocop_todo.yml +0 -991
  40. data/.ruby-gemset +0 -1
  41. data/.travis.yml +0 -69
  42. data/.yardopts +0 -1
  43. data/Gemfile +0 -28
  44. data/Rakefile +0 -32
  45. data/appveyor.yml +0 -27
  46. data/cucumber.gemspec +0 -52
  47. data/cucumber.yml +0 -19
  48. data/examples/i18n/README.textile +0 -3
  49. data/examples/i18n/Rakefile +0 -33
  50. data/examples/i18n/ar/Rakefile +0 -6
  51. data/examples/i18n/ar/features/addition.feature +0 -17
  52. data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +0 -29
  53. data/examples/i18n/ar/lib/calculator.rb +0 -11
  54. data/examples/i18n/bg/Rakefile +0 -6
  55. data/examples/i18n/bg/features/addition.feature +0 -12
  56. data/examples/i18n/bg/features/consecutive_calculations.feature +0 -19
  57. data/examples/i18n/bg/features/division.feature +0 -17
  58. data/examples/i18n/bg/features/step_definitions/calculator_steps.rb +0 -24
  59. data/examples/i18n/bg/features/support/env.rb +0 -10
  60. data/examples/i18n/bg/features/support/world.rb +0 -8
  61. data/examples/i18n/bg/lib/calculator.rb +0 -25
  62. data/examples/i18n/ca/Rakefile +0 -6
  63. data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +0 -26
  64. data/examples/i18n/ca/features/suma.feature +0 -17
  65. data/examples/i18n/ca/lib/calculadora.rb +0 -16
  66. data/examples/i18n/cs/Rakefile +0 -6
  67. data/examples/i18n/cs/features/addition.feature +0 -17
  68. data/examples/i18n/cs/features/division.feature +0 -11
  69. data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +0 -29
  70. data/examples/i18n/cs/lib/calculator.rb +0 -14
  71. data/examples/i18n/da/Rakefile +0 -6
  72. data/examples/i18n/da/features/sammenlaegning.feature +0 -18
  73. data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +0 -29
  74. data/examples/i18n/da/lib/lommeregner.rb +0 -11
  75. data/examples/i18n/de/Rakefile +0 -6
  76. data/examples/i18n/de/features/addition.feature +0 -17
  77. data/examples/i18n/de/features/division.feature +0 -10
  78. data/examples/i18n/de/features/step_definitions/calculator_steps.rb +0 -29
  79. data/examples/i18n/de/lib/calculator.rb +0 -14
  80. data/examples/i18n/el/Rakefile +0 -6
  81. data/examples/i18n/el/features/addition.feature +0 -17
  82. data/examples/i18n/el/features/division.feature +0 -10
  83. data/examples/i18n/el/features/step_definitions/calculator_steps.rb +0 -29
  84. data/examples/i18n/el/lib/calculator.rb +0 -14
  85. data/examples/i18n/en/Rakefile +0 -6
  86. data/examples/i18n/en/features/addition.feature +0 -17
  87. data/examples/i18n/en/features/division.feature +0 -10
  88. data/examples/i18n/en/features/step_definitions/calculator_steps.rb +0 -29
  89. data/examples/i18n/en/lib/calculator.rb +0 -14
  90. data/examples/i18n/en-lol/Rakefile +0 -4
  91. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +0 -16
  92. data/examples/i18n/en-lol/features/stuffing.feature +0 -8
  93. data/examples/i18n/en-lol/features/support/env.rb +0 -11
  94. data/examples/i18n/en-lol/lib/basket.rb +0 -12
  95. data/examples/i18n/en-lol/lib/belly.rb +0 -11
  96. data/examples/i18n/eo/Rakefile +0 -6
  97. data/examples/i18n/eo/features/adicio.feature +0 -17
  98. data/examples/i18n/eo/features/divido.feature +0 -10
  99. data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +0 -29
  100. data/examples/i18n/eo/lib/calculator.rb +0 -14
  101. data/examples/i18n/es/Rakefile +0 -6
  102. data/examples/i18n/es/features/adicion.feature +0 -17
  103. data/examples/i18n/es/features/step_definitions/calculador_steps.rb +0 -26
  104. data/examples/i18n/es/lib/calculador.rb +0 -14
  105. data/examples/i18n/et/Rakefile +0 -6
  106. data/examples/i18n/et/features/jagamine.feature +0 -10
  107. data/examples/i18n/et/features/liitmine.feature +0 -17
  108. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +0 -29
  109. data/examples/i18n/et/lib/kalkulaator.rb +0 -14
  110. data/examples/i18n/fi/Rakefile +0 -6
  111. data/examples/i18n/fi/features/jakolasku.feature +0 -10
  112. data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +0 -29
  113. data/examples/i18n/fi/features/yhteenlasku.feature +0 -17
  114. data/examples/i18n/fi/lib/laskin.rb +0 -14
  115. data/examples/i18n/fr/Rakefile +0 -8
  116. data/examples/i18n/fr/features/addition.feature +0 -18
  117. data/examples/i18n/fr/features/addition2.feature +0 -17
  118. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +0 -32
  119. data/examples/i18n/fr/features/support/env.rb +0 -10
  120. data/examples/i18n/fr/lib/calculatrice.rb +0 -10
  121. data/examples/i18n/he/Rakefile +0 -6
  122. data/examples/i18n/he/features/addition.feature +0 -17
  123. data/examples/i18n/he/features/division.feature +0 -10
  124. data/examples/i18n/he/features/step_definitions/calculator_steps.rb +0 -29
  125. data/examples/i18n/he/lib/calculator.rb +0 -15
  126. data/examples/i18n/hi/Rakefile +0 -6
  127. data/examples/i18n/hi/features/addition.feature +0 -16
  128. data/examples/i18n/hi/features/division.feature +0 -10
  129. data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +0 -29
  130. data/examples/i18n/hi/lib/calculator.rb +0 -15
  131. data/examples/i18n/ht/Rakefile +0 -6
  132. data/examples/i18n/ht/features/adisyon.feature +0 -17
  133. data/examples/i18n/ht/features/divizyon.feature +0 -10
  134. data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +0 -29
  135. data/examples/i18n/ht/lib/kalkilatris.rb +0 -14
  136. data/examples/i18n/hu/Rakefile +0 -6
  137. data/examples/i18n/hu/features/osszeadas.feature +0 -17
  138. data/examples/i18n/hu/features/osztas.feature +0 -10
  139. data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +0 -30
  140. data/examples/i18n/hu/lib/calculator.rb +0 -14
  141. data/examples/i18n/id/Rakefile +0 -6
  142. data/examples/i18n/id/features/addition.feature +0 -17
  143. data/examples/i18n/id/features/division.feature +0 -10
  144. data/examples/i18n/id/features/step_definitions/calculator_steps.rb +0 -29
  145. data/examples/i18n/id/lib/calculator.rb +0 -14
  146. data/examples/i18n/it/Rakefile +0 -6
  147. data/examples/i18n/it/features/somma.feature +0 -11
  148. data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +0 -29
  149. data/examples/i18n/it/lib/calcolatrice.rb +0 -11
  150. data/examples/i18n/ja/Rakefile +0 -6
  151. data/examples/i18n/ja/features/addition.feature +0 -17
  152. data/examples/i18n/ja/features/division.feature +0 -10
  153. data/examples/i18n/ja/features/step_definitions/calculator_steps.rb +0 -19
  154. data/examples/i18n/ja/features/support/env.rb +0 -10
  155. data/examples/i18n/ja/lib/calculator.rb +0 -14
  156. data/examples/i18n/ko/Rakefile +0 -6
  157. data/examples/i18n/ko/features/addition.feature +0 -17
  158. data/examples/i18n/ko/features/division.feature +0 -11
  159. data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +0 -29
  160. data/examples/i18n/ko/lib/calculator.rb +0 -14
  161. data/examples/i18n/lt/Rakefile +0 -6
  162. data/examples/i18n/lt/features/addition.feature +0 -17
  163. data/examples/i18n/lt/features/division.feature +0 -10
  164. data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +0 -29
  165. data/examples/i18n/lt/lib/calculator.rb +0 -14
  166. data/examples/i18n/lv/Rakefile +0 -6
  167. data/examples/i18n/lv/features/addition.feature +0 -17
  168. data/examples/i18n/lv/features/division.feature +0 -10
  169. data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +0 -29
  170. data/examples/i18n/lv/lib/calculator.rb +0 -14
  171. data/examples/i18n/no/Rakefile +0 -6
  172. data/examples/i18n/no/features/step_definitions/kalkulator_steps.rb +0 -17
  173. data/examples/i18n/no/features/summering.feature +0 -19
  174. data/examples/i18n/no/features/support/env.rb +0 -11
  175. data/examples/i18n/no/lib/kalkulator.rb +0 -11
  176. data/examples/i18n/pl/Rakefile +0 -6
  177. data/examples/i18n/pl/features/addition.feature +0 -17
  178. data/examples/i18n/pl/features/division.feature +0 -10
  179. data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +0 -29
  180. data/examples/i18n/pl/features/support/env.rb +0 -10
  181. data/examples/i18n/pl/lib/calculator.rb +0 -14
  182. data/examples/i18n/pt/Rakefile +0 -6
  183. data/examples/i18n/pt/features/adicao.feature +0 -11
  184. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +0 -20
  185. data/examples/i18n/pt/features/support/env.rb +0 -10
  186. data/examples/i18n/pt/lib/calculadora.rb +0 -10
  187. data/examples/i18n/ro/Rakefile +0 -6
  188. data/examples/i18n/ro/features/adunare.feature +0 -12
  189. data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +0 -26
  190. data/examples/i18n/ro/lib/calculator.rb +0 -11
  191. data/examples/i18n/ru/Rakefile +0 -6
  192. data/examples/i18n/ru/features/addition.feature +0 -11
  193. data/examples/i18n/ru/features/consecutive_calculations.feature +0 -17
  194. data/examples/i18n/ru/features/division.feature +0 -16
  195. data/examples/i18n/ru/features/step_definitions/calculator_steps.rb +0 -19
  196. data/examples/i18n/ru/features/support/env.rb +0 -10
  197. data/examples/i18n/ru/features/support/world.rb +0 -8
  198. data/examples/i18n/ru/lib/calculator.rb +0 -25
  199. data/examples/i18n/sk/Rakefile +0 -6
  200. data/examples/i18n/sk/features/addition.feature +0 -17
  201. data/examples/i18n/sk/features/division.feature +0 -10
  202. data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +0 -29
  203. data/examples/i18n/sk/lib/calculator.rb +0 -14
  204. data/examples/i18n/sr-Cyrl/Rakefile +0 -6
  205. data/examples/i18n/sr-Cyrl/features/sabiranje.feature +0 -18
  206. data/examples/i18n/sr-Cyrl/features/step_definitions/calculator_steps.rb +0 -20
  207. data/examples/i18n/sr-Cyrl/features/support/env.rb +0 -10
  208. data/examples/i18n/sr-Cyrl/lib/calculator.rb +0 -12
  209. data/examples/i18n/sr-Latn/Rakefile +0 -6
  210. data/examples/i18n/sr-Latn/features/sabiranje.feature +0 -18
  211. data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +0 -29
  212. data/examples/i18n/sr-Latn/lib/calculator.rb +0 -12
  213. data/examples/i18n/sv/Rakefile +0 -6
  214. data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +0 -29
  215. data/examples/i18n/sv/features/summering.feature +0 -18
  216. data/examples/i18n/sv/lib/kalkulator.rb +0 -11
  217. data/examples/i18n/tr/Rakefile +0 -6
  218. data/examples/i18n/tr/features/bolme.feature +0 -10
  219. data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +0 -29
  220. data/examples/i18n/tr/features/toplama.feature +0 -18
  221. data/examples/i18n/tr/lib/hesap_makinesi.rb +0 -15
  222. data/examples/i18n/uk/Rakefile +0 -6
  223. data/examples/i18n/uk/features/addition.feature +0 -11
  224. data/examples/i18n/uk/features/consecutive_calculations.feature +0 -17
  225. data/examples/i18n/uk/features/division.feature +0 -16
  226. data/examples/i18n/uk/features/step_definitions/calculator_steps.rb +0 -19
  227. data/examples/i18n/uk/features/support/env.rb +0 -10
  228. data/examples/i18n/uk/features/support/world.rb +0 -8
  229. data/examples/i18n/uk/lib/calculator.rb +0 -25
  230. data/examples/i18n/uz/Rakefile +0 -6
  231. data/examples/i18n/uz/features/addition.feature +0 -10
  232. data/examples/i18n/uz/features/consecutive_calculations.feature +0 -17
  233. data/examples/i18n/uz/features/division.feature +0 -17
  234. data/examples/i18n/uz/features/step_definitions/calculator_steps.rb +0 -19
  235. data/examples/i18n/uz/features/support/env.rb +0 -10
  236. data/examples/i18n/uz/features/support/world.rb +0 -8
  237. data/examples/i18n/uz/lib/calculator.rb +0 -25
  238. data/examples/i18n/zh-CN/Rakefile +0 -4
  239. data/examples/i18n/zh-CN/features/addition.feature +0 -18
  240. data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +0 -31
  241. data/examples/i18n/zh-CN/lib/calculator.rb +0 -10
  242. data/examples/i18n/zh-TW/Rakefile +0 -4
  243. data/examples/i18n/zh-TW/features/addition.feature +0 -17
  244. data/examples/i18n/zh-TW/features/division.feature +0 -11
  245. data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +0 -29
  246. data/examples/i18n/zh-TW/lib/calculator.rb +0 -14
  247. data/examples/rspec_doubles/Rakefile +0 -4
  248. data/examples/rspec_doubles/features/mocking.feature +0 -9
  249. data/examples/rspec_doubles/features/step_definitions/calvin_steps.rb +0 -19
  250. data/examples/rspec_doubles/features/support/env.rb +0 -12
  251. data/examples/sinatra/README.textile +0 -13
  252. data/examples/sinatra/Rakefile +0 -6
  253. data/examples/sinatra/app.rb +0 -14
  254. data/examples/sinatra/features/add.feature +0 -11
  255. data/examples/sinatra/features/step_definitions/add_steps.rb +0 -15
  256. data/examples/sinatra/features/support/env.rb +0 -15
  257. data/examples/sinatra/views/add.erb +0 -7
  258. data/examples/sinatra/views/layout.erb +0 -8
  259. data/examples/tcl/README.textile +0 -11
  260. data/examples/tcl/Rakefile +0 -6
  261. data/examples/tcl/features/fibonnacci.feature +0 -17
  262. data/examples/tcl/features/step_definitions/fib_steps.rb +0 -7
  263. data/examples/tcl/features/support/env.rb +0 -7
  264. data/examples/tcl/src/fib.tcl +0 -3
  265. data/examples/test_unit/Gemfile +0 -4
  266. data/examples/test_unit/Rakefile +0 -6
  267. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +0 -20
  268. data/examples/test_unit/features/test_unit.feature +0 -9
  269. data/examples/watir/README.textile +0 -16
  270. data/examples/watir/Rakefile +0 -12
  271. data/examples/watir/cucumber.yml +0 -1
  272. data/examples/watir/features/search.feature +0 -12
  273. data/examples/watir/features/step_definitions/search_steps.rb +0 -27
  274. data/examples/watir/features/support/env.rb +0 -39
  275. data/examples/watir/features/support/screenshots.rb +0 -47
  276. data/features/docs/api/list_step_defs_as_json.feature +0 -64
  277. data/features/docs/api/listen_for_events.feature +0 -59
  278. data/features/docs/api/run_cli_main_with_existing_runtime.feature +0 -27
  279. data/features/docs/cli/backtraces.feature +0 -36
  280. data/features/docs/cli/dry_run.feature +0 -73
  281. data/features/docs/cli/exclude_files.feature +0 -18
  282. data/features/docs/cli/execute_with_tag_filter.feature +0 -119
  283. data/features/docs/cli/fail_fast.feature +0 -48
  284. data/features/docs/cli/finding_steps.feature +0 -28
  285. data/features/docs/cli/help.feature +0 -8
  286. data/features/docs/cli/i18n.feature +0 -42
  287. data/features/docs/cli/randomize.feature +0 -140
  288. data/features/docs/cli/require.feature +0 -27
  289. data/features/docs/cli/retry_failing_tests.feature +0 -92
  290. data/features/docs/cli/run_scenarios_matching_name.feature +0 -105
  291. data/features/docs/cli/run_specific_scenarios.feature +0 -77
  292. data/features/docs/cli/showing_differences.feature +0 -43
  293. data/features/docs/cli/specifying_multiple_formatters.feature +0 -68
  294. data/features/docs/cli/strict_mode.feature +0 -70
  295. data/features/docs/defining_steps/ambiguous_steps.feature +0 -89
  296. data/features/docs/defining_steps/nested_steps.feature +0 -181
  297. data/features/docs/defining_steps/nested_steps_i18n.feature +0 -37
  298. data/features/docs/defining_steps/nested_steps_with_second_arg.feature +0 -56
  299. data/features/docs/defining_steps/one_line_step_definitions.feature +0 -65
  300. data/features/docs/defining_steps/printing_messages.feature +0 -147
  301. data/features/docs/defining_steps/skip_scenario.feature +0 -31
  302. data/features/docs/defining_steps/snippets.feature +0 -56
  303. data/features/docs/defining_steps/table_diffing.feature +0 -50
  304. data/features/docs/events/gherkin_source_read_event.feature +0 -43
  305. data/features/docs/events/step_activated_event.feature +0 -36
  306. data/features/docs/events/step_definition_registered_event.feature +0 -29
  307. data/features/docs/events/test_case_finished_event.feature +0 -35
  308. data/features/docs/events/test_case_started_event.feature +0 -54
  309. data/features/docs/events/test_run_finished_event.feature +0 -40
  310. data/features/docs/events/test_run_started_event.feature +0 -41
  311. data/features/docs/events/test_step_finished_event.feature +0 -47
  312. data/features/docs/events/test_step_started_event.feature +0 -43
  313. data/features/docs/exception_in_after_hook.feature +0 -127
  314. data/features/docs/exception_in_after_step_hook.feature +0 -104
  315. data/features/docs/exception_in_around_hook.feature +0 -80
  316. data/features/docs/exception_in_before_hook.feature +0 -98
  317. data/features/docs/extending_cucumber/custom_filter.feature +0 -29
  318. data/features/docs/extending_cucumber/custom_formatter.feature +0 -94
  319. data/features/docs/formatters/api_methods.feature +0 -37
  320. data/features/docs/formatters/html_formatter.feature +0 -91
  321. data/features/docs/formatters/json_formatter.feature +0 -767
  322. data/features/docs/formatters/junit_formatter.feature +0 -455
  323. data/features/docs/formatters/pretty_formatter.feature +0 -74
  324. data/features/docs/formatters/progress_formatter.feature +0 -32
  325. data/features/docs/formatters/rerun_formatter.feature +0 -190
  326. data/features/docs/formatters/summary_formatter.feature +0 -35
  327. data/features/docs/formatters/usage_formatter.feature +0 -101
  328. data/features/docs/getting_started.feature +0 -28
  329. data/features/docs/gherkin/background.feature +0 -548
  330. data/features/docs/gherkin/doc_strings.feature +0 -76
  331. data/features/docs/gherkin/expand_option_for_outlines.feature +0 -47
  332. data/features/docs/gherkin/language_from_header.feature +0 -32
  333. data/features/docs/gherkin/outlines.feature +0 -158
  334. data/features/docs/gherkin/unicode_table.feature +0 -33
  335. data/features/docs/gherkin/using_descriptions.feature +0 -83
  336. data/features/docs/gherkin/using_star_notation.feature +0 -37
  337. data/features/docs/iso-8859-1.feature +0 -6
  338. data/features/docs/post_configuration_hook.feature +0 -33
  339. data/features/docs/profiles.feature +0 -120
  340. data/features/docs/rake_task.feature +0 -146
  341. data/features/docs/raketask.feature +0 -46
  342. data/features/docs/work_in_progress.feature +0 -157
  343. data/features/docs/writing_support_code/after_hooks.feature +0 -102
  344. data/features/docs/writing_support_code/after_step_hooks.feature +0 -55
  345. data/features/docs/writing_support_code/around_hooks.feature +0 -266
  346. data/features/docs/writing_support_code/before_hook.feature +0 -66
  347. data/features/docs/writing_support_code/hook_order.feature +0 -63
  348. data/features/docs/writing_support_code/load_path.feature +0 -17
  349. data/features/docs/writing_support_code/parameter_types.feature +0 -53
  350. data/features/docs/writing_support_code/state.feature +0 -32
  351. data/features/docs/writing_support_code/tagged_hooks.feature +0 -95
  352. data/features/docs/writing_support_code/world.feature +0 -129
  353. data/features/lib/step_definitions/aruba_steps.rb +0 -21
  354. data/features/lib/step_definitions/cli_steps.rb +0 -4
  355. data/features/lib/step_definitions/cucumber_steps.rb +0 -75
  356. data/features/lib/step_definitions/iso-8859-1_steps.rb +0 -16
  357. data/features/lib/step_definitions/json_steps.rb +0 -8
  358. data/features/lib/step_definitions/junit_steps.rb +0 -14
  359. data/features/lib/step_definitions/language_steps.rb +0 -9
  360. data/features/lib/step_definitions/profile_steps.rb +0 -16
  361. data/features/lib/step_definitions/retry_steps.rb +0 -55
  362. data/features/lib/step_definitions/ruby_steps.rb +0 -4
  363. data/features/lib/support/env.rb +0 -22
  364. data/features/lib/support/fake_wire_server.rb +0 -94
  365. data/features/lib/support/feature_factory.rb +0 -68
  366. data/features/lib/support/normalise_output.rb +0 -52
  367. data/features/lib/support/parameter_types.rb +0 -5
  368. data/gem_tasks/contributors.rake +0 -19
  369. data/gem_tasks/cov.rake +0 -6
  370. data/gem_tasks/downloads.rb +0 -8
  371. data/gem_tasks/environment.rake +0 -4
  372. data/gem_tasks/examples.rake +0 -12
  373. data/gem_tasks/fix_cr_lf.rake +0 -22
  374. data/gem_tasks/flog.rake +0 -5
  375. data/gem_tasks/rspec.rake +0 -7
  376. data/gem_tasks/sass.rake +0 -5
  377. data/gem_tasks/stats +0 -16
  378. data/gem_tasks/versions.txt +0 -74
  379. data/scripts/invite-collaborator +0 -40
  380. data/scripts/update-changelog +0 -86
  381. data/spec/cucumber/cli/configuration_spec.rb +0 -446
  382. data/spec/cucumber/cli/main_spec.rb +0 -84
  383. data/spec/cucumber/cli/options_spec.rb +0 -445
  384. data/spec/cucumber/cli/profile_loader_spec.rb +0 -66
  385. data/spec/cucumber/cli/rerun_spec.rb +0 -86
  386. data/spec/cucumber/configuration_spec.rb +0 -148
  387. data/spec/cucumber/constantize_spec.rb +0 -20
  388. data/spec/cucumber/events_spec.rb +0 -9
  389. data/spec/cucumber/file_specs_spec.rb +0 -61
  390. data/spec/cucumber/filters/activate_steps_spec.rb +0 -152
  391. data/spec/cucumber/filters/gated_receiver_spec.rb +0 -48
  392. data/spec/cucumber/filters/retry_spec.rb +0 -98
  393. data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +0 -39
  394. data/spec/cucumber/filters/tag_limits/verifier_spec.rb +0 -58
  395. data/spec/cucumber/filters/tag_limits_spec.rb +0 -60
  396. data/spec/cucumber/formatter/ansicolor_spec.rb +0 -33
  397. data/spec/cucumber/formatter/backtrace_filter_spec.rb +0 -32
  398. data/spec/cucumber/formatter/console_counts_spec.rb +0 -14
  399. data/spec/cucumber/formatter/duration_spec.rb +0 -23
  400. data/spec/cucumber/formatter/fail_fast_spec.rb +0 -88
  401. data/spec/cucumber/formatter/html_spec.rb +0 -543
  402. data/spec/cucumber/formatter/interceptor_spec.rb +0 -137
  403. data/spec/cucumber/formatter/json_spec.rb +0 -815
  404. data/spec/cucumber/formatter/junit_spec.rb +0 -251
  405. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +0 -2175
  406. data/spec/cucumber/formatter/pretty_spec.rb +0 -907
  407. data/spec/cucumber/formatter/progress_spec.rb +0 -170
  408. data/spec/cucumber/formatter/rerun_spec.rb +0 -97
  409. data/spec/cucumber/formatter/spec_helper.rb +0 -84
  410. data/spec/cucumber/glue/proto_world_spec.rb +0 -63
  411. data/spec/cucumber/glue/registry_and_more_spec.rb +0 -213
  412. data/spec/cucumber/glue/snippet_spec.rb +0 -174
  413. data/spec/cucumber/glue/step_definition_spec.rb +0 -207
  414. data/spec/cucumber/hooks_spec.rb +0 -31
  415. data/spec/cucumber/multiline_argument/data_table_spec.rb +0 -653
  416. data/spec/cucumber/project_initializer_spec.rb +0 -88
  417. data/spec/cucumber/rake/forked_spec.rb +0 -58
  418. data/spec/cucumber/rake/task_spec.rb +0 -86
  419. data/spec/cucumber/running_test_case_spec.rb +0 -140
  420. data/spec/cucumber/runtime/for_programming_languages_spec.rb +0 -8
  421. data/spec/cucumber/runtime/support_code_spec.rb +0 -17
  422. data/spec/cucumber/runtime_spec.rb +0 -21
  423. data/spec/cucumber/sell_cucumbers.feature +0 -19
  424. data/spec/cucumber/step_argument_spec.rb +0 -19
  425. data/spec/cucumber/step_match_search_spec.rb +0 -113
  426. data/spec/cucumber/step_match_spec.rb +0 -86
  427. data/spec/cucumber/world/pending_spec.rb +0 -48
  428. data/spec/spec_helper.rb +0 -30
  429. data/spec/support/standard_step_actions.rb +0 -19
@@ -1,815 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
- require 'cucumber/formatter/spec_helper'
4
- require 'cucumber/formatter/json'
5
- require 'cucumber/cli/options'
6
- require 'multi_json'
7
-
8
- module Cucumber
9
- module Formatter
10
- describe Json do
11
- extend SpecHelperDsl
12
- include SpecHelper
13
-
14
- context 'Given a single feature' do
15
- before(:each) do
16
- @out = StringIO.new
17
- @formatter = Json.new(actual_runtime.configuration.with_options(out_stream: @out))
18
- run_defined_feature
19
- end
20
-
21
- describe 'with a scenario with an undefined step' do
22
- define_feature <<-FEATURE
23
- Feature: Banana party
24
-
25
- Scenario: Monkey eats bananas
26
- Given there are bananas
27
- FEATURE
28
-
29
- it 'outputs the json data' do
30
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
31
- [{"id": "banana-party",
32
- "uri": "spec.feature",
33
- "keyword": "Feature",
34
- "name": "Banana party",
35
- "line": 1,
36
- "description": "",
37
- "elements":
38
- [{"id": "banana-party;monkey-eats-bananas",
39
- "keyword": "Scenario",
40
- "name": "Monkey eats bananas",
41
- "line": 3,
42
- "description": "",
43
- "type": "scenario",
44
- "steps":
45
- [{"keyword": "Given ",
46
- "name": "there are bananas",
47
- "line": 4,
48
- "match": {"location": "spec.feature:4"},
49
- "result": {"status": "undefined"}}]}]}]})
50
- end
51
- end
52
-
53
- describe 'with a scenario with a passed step' do
54
- define_feature <<-FEATURE
55
- Feature: Banana party
56
-
57
- Scenario: Monkey eats bananas
58
- Given there are bananas
59
- FEATURE
60
-
61
- define_steps do
62
- Given(/^there are bananas$/) {}
63
- end
64
-
65
- it 'outputs the json data' do
66
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
67
- [{"id": "banana-party",
68
- "uri": "spec.feature",
69
- "keyword": "Feature",
70
- "name": "Banana party",
71
- "line": 1,
72
- "description": "",
73
- "elements":
74
- [{"id": "banana-party;monkey-eats-bananas",
75
- "keyword": "Scenario",
76
- "name": "Monkey eats bananas",
77
- "line": 3,
78
- "description": "",
79
- "type": "scenario",
80
- "steps":
81
- [{"keyword": "Given ",
82
- "name": "there are bananas",
83
- "line": 4,
84
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:62"},
85
- "result": {"status": "passed",
86
- "duration": 1}}]}]}]})
87
- end
88
- end
89
-
90
- describe 'with a scenario with a failed step' do
91
- define_feature <<-FEATURE
92
- Feature: Banana party
93
-
94
- Scenario: Monkey eats bananas
95
- Given there are bananas
96
- FEATURE
97
-
98
- define_steps do
99
- Given(/^there are bananas$/) { raise 'no bananas' }
100
- end
101
-
102
- it 'outputs the json data' do
103
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
104
- [{"id": "banana-party",
105
- "uri": "spec.feature",
106
- "keyword": "Feature",
107
- "name": "Banana party",
108
- "line": 1,
109
- "description": "",
110
- "elements":
111
- [{"id": "banana-party;monkey-eats-bananas",
112
- "keyword": "Scenario",
113
- "name": "Monkey eats bananas",
114
- "line": 3,
115
- "description": "",
116
- "type": "scenario",
117
- "steps":
118
- [{"keyword": "Given ",
119
- "name": "there are bananas",
120
- "line": 4,
121
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:99"},
122
- "result": {"status": "failed",
123
- "error_message": "no bananas (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:99:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
124
- "duration": 1}}]}]}]})
125
- end
126
- end
127
-
128
- describe 'with a scenario with a pending step' do
129
- define_feature <<-FEATURE
130
- Feature: Banana party
131
-
132
- Scenario: Monkey eats bananas
133
- Given there are bananas
134
- FEATURE
135
-
136
- define_steps do
137
- Given(/^there are bananas$/) { pending }
138
- end
139
-
140
- it 'outputs the json data' do
141
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
142
- [{"id": "banana-party",
143
- "uri": "spec.feature",
144
- "keyword": "Feature",
145
- "name": "Banana party",
146
- "line": 1,
147
- "description": "",
148
- "elements":
149
- [{"id": "banana-party;monkey-eats-bananas",
150
- "keyword": "Scenario",
151
- "name": "Monkey eats bananas",
152
- "line": 3,
153
- "description": "",
154
- "type": "scenario",
155
- "steps":
156
- [{"keyword": "Given ",
157
- "name": "there are bananas",
158
- "line": 4,
159
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:137"},
160
- "result": {"status": "pending",
161
- "error_message": "TODO (Cucumber::Pending)\\n./spec/cucumber/formatter/json_spec.rb:137:in `/^there are bananas$/'\\nspec.feature:4:in `Given there are bananas'",
162
- "duration": 1}}]}]}]})
163
- end
164
- end
165
-
166
- describe 'with a scenario outline with one example' do
167
- define_feature <<-FEATURE
168
- Feature: Banana party
169
-
170
- Scenario Outline: Monkey eats bananas
171
- Given there are <fruit>
172
-
173
- Examples: Fruit Table
174
- | fruit |
175
- | bananas |
176
- FEATURE
177
-
178
- define_steps do
179
- Given(/^there are bananas$/) {}
180
- end
181
-
182
- it 'outputs the json data' do
183
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
184
- [{"id": "banana-party",
185
- "uri": "spec.feature",
186
- "keyword": "Feature",
187
- "name": "Banana party",
188
- "line": 1,
189
- "description": "",
190
- "elements":
191
- [{"id": "banana-party;monkey-eats-bananas;fruit-table;2",
192
- "keyword": "Scenario Outline",
193
- "name": "Monkey eats bananas",
194
- "line": 8,
195
- "description": "",
196
- "type": "scenario",
197
- "steps":
198
- [{"keyword": "Given ",
199
- "name": "there are bananas",
200
- "line": 8,
201
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:179"},
202
- "result": {"status": "passed",
203
- "duration": 1}}]}]}]})
204
- end
205
- end
206
-
207
- describe 'with tags in the feature file' do
208
- define_feature <<-FEATURE
209
- @f
210
- Feature: Banana party
211
-
212
- @s
213
- Scenario: Monkey eats bananas
214
- Given there are bananas
215
-
216
- @so
217
- Scenario Outline: Monkey eats bananas
218
- Given there are <fruit>
219
-
220
- @ex
221
- Examples: Fruit Table
222
- | fruit |
223
- | bananas |
224
- FEATURE
225
-
226
- define_steps do
227
- Given(/^there are bananas$/) {}
228
- end
229
-
230
- it 'the tags are included in the json data' do
231
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
232
- [{"id": "banana-party",
233
- "uri": "spec.feature",
234
- "keyword": "Feature",
235
- "name": "Banana party",
236
- "line": 2,
237
- "description": "",
238
- "tags": [{"name": "@f",
239
- "line": 1}],
240
- "elements":
241
- [{"id": "banana-party;monkey-eats-bananas",
242
- "keyword": "Scenario",
243
- "name": "Monkey eats bananas",
244
- "line": 5,
245
- "description": "",
246
- "tags": [{"name": "@f",
247
- "line": 1},
248
- {"name": "@s",
249
- "line": 4}],
250
- "type": "scenario",
251
- "steps":
252
- [{"keyword": "Given ",
253
- "name": "there are bananas",
254
- "line": 6,
255
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:227"},
256
- "result": {"status": "passed",
257
- "duration": 1}}]},
258
- {"id": "banana-party;monkey-eats-bananas;fruit-table;2",
259
- "keyword": "Scenario Outline",
260
- "name": "Monkey eats bananas",
261
- "line": 15,
262
- "description": "",
263
- "tags": [{"name": "@f",
264
- "line": 1},
265
- {"name": "@so",
266
- "line": 8},
267
- {"name": "@ex",
268
- "line": 12}],
269
- "type": "scenario",
270
- "steps":
271
- [{"keyword": "Given ",
272
- "name": "there are bananas",
273
- "line": 15,
274
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:227"},
275
- "result": {"status": "passed",
276
- "duration": 1}}]}]}]})
277
- end
278
- end
279
-
280
- describe 'with comments in the feature file' do
281
- define_feature <<-FEATURE
282
- #feature comment
283
- Feature: Banana party
284
-
285
- #background comment
286
- Background: There are bananas
287
- Given there are bananas
288
-
289
- #scenario comment
290
- Scenario: Monkey eats bananas
291
- #step comment1
292
- Then the monkey eats bananas
293
-
294
- #scenario outline comment
295
- Scenario Outline: Monkey eats bananas
296
- #step comment2
297
- Then the monkey eats <fruit>
298
-
299
- #examples table comment
300
- Examples: Fruit Table
301
- | fruit |
302
- #examples table row comment
303
- | bananas |
304
- FEATURE
305
-
306
- define_steps do
307
- Given(/^there are bananas$/) {}
308
- Then(/^the monkey eats bananas$/) {}
309
- end
310
-
311
- it 'the comments are included in the json data' do
312
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
313
- [{"id": "banana-party",
314
- "uri": "spec.feature",
315
- "keyword": "Feature",
316
- "name": "Banana party",
317
- "line": 2,
318
- "description": "",
319
- "comments": [{"value": "#feature comment",
320
- "line": 1}],
321
- "elements":
322
- [{"keyword": "Background",
323
- "name": "There are bananas",
324
- "line": 5,
325
- "description": "",
326
- "comments": [{"value": "#background comment",
327
- "line": 4}],
328
- "type": "background",
329
- "steps":
330
- [{"keyword": "Given ",
331
- "name": "there are bananas",
332
- "line": 6,
333
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:307"},
334
- "result": {"status": "passed",
335
- "duration": 1}}]},
336
- {"id": "banana-party;monkey-eats-bananas",
337
- "keyword": "Scenario",
338
- "name": "Monkey eats bananas",
339
- "line": 9,
340
- "description": "",
341
- "comments": [{"value": "#scenario comment",
342
- "line": 8}],
343
- "type": "scenario",
344
- "steps":
345
- [{"keyword": "Then ",
346
- "name": "the monkey eats bananas",
347
- "line": 11,
348
- "comments": [{"value": "#step comment1",
349
- "line": 10}],
350
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:308"},
351
- "result": {"status": "passed",
352
- "duration": 1}}]},
353
- {"keyword": "Background",
354
- "name": "There are bananas",
355
- "line": 5,
356
- "description": "",
357
- "comments": [{"value": "#background comment",
358
- "line": 4}],
359
- "type": "background",
360
- "steps":
361
- [{"keyword": "Given ",
362
- "name": "there are bananas",
363
- "line": 6,
364
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:307"},
365
- "result": {"status": "passed",
366
- "duration": 1}}]},
367
- {"id": "banana-party;monkey-eats-bananas;fruit-table;2",
368
- "keyword": "Scenario Outline",
369
- "name": "Monkey eats bananas",
370
- "line": 22,
371
- "description": "",
372
- "comments": [{"value": "#scenario outline comment",
373
- "line": 13},
374
- {"value": "#examples table comment",
375
- "line": 18},
376
- {"value": "#examples table row comment",
377
- "line": 21}],
378
- "type": "scenario",
379
- "steps":
380
- [{"keyword": "Then ",
381
- "name": "the monkey eats bananas",
382
- "line": 22,
383
- "comments": [{"value": "#step comment2",
384
- "line": 15}],
385
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:308"},
386
- "result": {"status": "passed",
387
- "duration": 1}}]}]}]})
388
- end
389
- end
390
-
391
- describe 'with a scenario with a step with a doc string' do
392
- define_feature <<-FEATURE
393
- Feature: Banana party
394
-
395
- Scenario: Monkey eats bananas
396
- Given there are bananas
397
- """
398
- the doc string
399
- """
400
- FEATURE
401
-
402
- define_steps do
403
- Given(/^there are bananas$/) { |s| s }
404
- end
405
-
406
- it 'includes the doc string in the json data' do
407
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
408
- [{"id": "banana-party",
409
- "uri": "spec.feature",
410
- "keyword": "Feature",
411
- "name": "Banana party",
412
- "line": 1,
413
- "description": "",
414
- "elements":
415
- [{"id": "banana-party;monkey-eats-bananas",
416
- "keyword": "Scenario",
417
- "name": "Monkey eats bananas",
418
- "line": 3,
419
- "description": "",
420
- "type": "scenario",
421
- "steps":
422
- [{"keyword": "Given ",
423
- "name": "there are bananas",
424
- "line": 4,
425
- "doc_string": {"value": "the doc string",
426
- "content_type": "",
427
- "line": 5},
428
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:403"},
429
- "result": {"status": "passed",
430
- "duration": 1}}]}]}]})
431
- end
432
- end
433
-
434
- describe 'with a scenario with a step that use puts' do
435
- define_feature <<-FEATURE
436
- Feature: Banana party
437
-
438
- Scenario: Monkey eats bananas
439
- Given there are bananas
440
- FEATURE
441
-
442
- define_steps do
443
- Given(/^there are bananas$/) { puts 'from step' }
444
- end
445
-
446
- it 'includes the output from the step in the json data' do
447
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
448
- [{"id": "banana-party",
449
- "uri": "spec.feature",
450
- "keyword": "Feature",
451
- "name": "Banana party",
452
- "line": 1,
453
- "description": "",
454
- "elements":
455
- [{"id": "banana-party;monkey-eats-bananas",
456
- "keyword": "Scenario",
457
- "name": "Monkey eats bananas",
458
- "line": 3,
459
- "description": "",
460
- "type": "scenario",
461
- "steps":
462
- [{"keyword": "Given ",
463
- "name": "there are bananas",
464
- "line": 4,
465
- "output": ["from step"],
466
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:443"},
467
- "result": {"status": "passed",
468
- "duration": 1}}]}]}]})
469
- end
470
- end
471
-
472
- describe 'with a background' do
473
- define_feature <<-FEATURE
474
- Feature: Banana party
475
-
476
- Background: There are bananas
477
- Given there are bananas
478
-
479
- Scenario: Monkey eats bananas
480
- Then the monkey eats bananas
481
-
482
- Scenario: Monkey eats more bananas
483
- Then the monkey eats more bananas
484
- FEATURE
485
-
486
- it 'includes the background in the json data each time it is executed' do
487
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
488
- [{"id": "banana-party",
489
- "uri": "spec.feature",
490
- "keyword": "Feature",
491
- "name": "Banana party",
492
- "line": 1,
493
- "description": "",
494
- "elements":
495
- [{"keyword": "Background",
496
- "name": "There are bananas",
497
- "line": 3,
498
- "description": "",
499
- "type": "background",
500
- "steps":
501
- [{"keyword": "Given ",
502
- "name": "there are bananas",
503
- "line": 4,
504
- "match": {"location": "spec.feature:4"},
505
- "result": {"status": "undefined"}}]},
506
- {"id": "banana-party;monkey-eats-bananas",
507
- "keyword": "Scenario",
508
- "name": "Monkey eats bananas",
509
- "line": 6,
510
- "description": "",
511
- "type": "scenario",
512
- "steps":
513
- [{"keyword": "Then ",
514
- "name": "the monkey eats bananas",
515
- "line": 7,
516
- "match": {"location": "spec.feature:7"},
517
- "result": {"status": "undefined"}}]},
518
- {"keyword": "Background",
519
- "name": "There are bananas",
520
- "line": 3,
521
- "description": "",
522
- "type": "background",
523
- "steps":
524
- [{"keyword": "Given ",
525
- "name": "there are bananas",
526
- "line": 4,
527
- "match": {"location": "spec.feature:4"},
528
- "result": {"status": "undefined"}}]},
529
- {"id": "banana-party;monkey-eats-more-bananas",
530
- "keyword": "Scenario",
531
- "name": "Monkey eats more bananas",
532
- "line": 9,
533
- "description": "",
534
- "type": "scenario",
535
- "steps":
536
- [{"keyword": "Then ",
537
- "name": "the monkey eats more bananas",
538
- "line": 10,
539
- "match": {"location": "spec.feature:10"},
540
- "result": {"status": "undefined"}}]}]}]})
541
- end
542
- end
543
-
544
- describe 'with a scenario with a step that embeds data directly' do
545
- define_feature <<-FEATURE
546
- Feature: Banana party
547
-
548
- Scenario: Monkey eats bananas
549
- Given there are bananas
550
- FEATURE
551
-
552
- define_steps do
553
- Given(/^there are bananas$/) { data = 'YWJj'
554
- embed data, 'mime-type;base64' }
555
- end
556
-
557
- it 'includes the data from the step in the json data' do
558
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
559
- [{"id": "banana-party",
560
- "uri": "spec.feature",
561
- "keyword": "Feature",
562
- "name": "Banana party",
563
- "line": 1,
564
- "description": "",
565
- "elements":
566
- [{"id": "banana-party;monkey-eats-bananas",
567
- "keyword": "Scenario",
568
- "name": "Monkey eats bananas",
569
- "line": 3,
570
- "description": "",
571
- "type": "scenario",
572
- "steps":
573
- [{"keyword": "Given ",
574
- "name": "there are bananas",
575
- "line": 4,
576
- "embeddings": [{"mime_type": "mime-type",
577
- "data": "YWJj"}],
578
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:553"},
579
- "result": {"status": "passed",
580
- "duration": 1}}]}]}]})
581
- end
582
- end
583
-
584
- describe 'with a scenario with a step that embeds a file' do
585
- define_feature <<-FEATURE
586
- Feature: Banana party
587
-
588
- Scenario: Monkey eats bananas
589
- Given there are bananas
590
- FEATURE
591
-
592
- define_steps do
593
- Given(/^there are bananas$/) {
594
- RSpec::Mocks.allow_message(File, :file?) { true }
595
- f1 = RSpec::Mocks::Double.new
596
- RSpec::Mocks.allow_message(File, :open) { |&block| block.call(f1) }
597
- RSpec::Mocks.allow_message(f1, :read) { 'foo' }
598
- embed('out/snapshot.jpeg', 'image/png')
599
- }
600
- end
601
-
602
- it 'includes the file content in the json data' do
603
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
604
- [{"id": "banana-party",
605
- "uri": "spec.feature",
606
- "keyword": "Feature",
607
- "name": "Banana party",
608
- "line": 1,
609
- "description": "",
610
- "elements":
611
- [{"id": "banana-party;monkey-eats-bananas",
612
- "keyword": "Scenario",
613
- "name": "Monkey eats bananas",
614
- "line": 3,
615
- "description": "",
616
- "type": "scenario",
617
- "steps":
618
- [{"keyword": "Given ",
619
- "name": "there are bananas",
620
- "line": 4,
621
- "embeddings": [{"mime_type": "image/png",
622
- "data": "Zm9v"}],
623
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:593"},
624
- "result": {"status": "passed",
625
- "duration": 1}}]}]}]})
626
- end
627
- end
628
-
629
- describe 'with a scenario with hooks' do
630
- define_feature <<-FEATURE
631
- Feature: Banana party
632
-
633
- Scenario: Monkey eats bananas
634
- Given there are bananas
635
- FEATURE
636
-
637
- define_steps do
638
- Before() {}
639
- Before() {}
640
- After() {}
641
- After() {}
642
- AfterStep() {}
643
- AfterStep() {}
644
- Around() { |scenario, block| block.call }
645
- Given(/^there are bananas$/) {}
646
- end
647
-
648
- it 'includes all hooks except the around hook in the json data' do
649
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
650
- [{"id": "banana-party",
651
- "uri": "spec.feature",
652
- "keyword": "Feature",
653
- "name": "Banana party",
654
- "line": 1,
655
- "description": "",
656
- "elements":
657
- [{"id": "banana-party;monkey-eats-bananas",
658
- "keyword": "Scenario",
659
- "name": "Monkey eats bananas",
660
- "line": 3,
661
- "description": "",
662
- "type": "scenario",
663
- "before":
664
- [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:638"},
665
- "result": {"status": "passed",
666
- "duration": 1}},
667
- {"match": {"location": "spec/cucumber/formatter/json_spec.rb:639"},
668
- "result": {"status": "passed",
669
- "duration": 1}}],
670
- "steps":
671
- [{"keyword": "Given ",
672
- "name": "there are bananas",
673
- "line": 4,
674
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:645"},
675
- "result": {"status": "passed",
676
- "duration": 1},
677
- "after":
678
- [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:642"},
679
- "result": {"status": "passed",
680
- "duration": 1}},
681
- {"match": {"location": "spec/cucumber/formatter/json_spec.rb:643"},
682
- "result": {"status": "passed",
683
- "duration": 1}}]}],
684
- "after":
685
- [{"match": {"location": "spec/cucumber/formatter/json_spec.rb:641"},
686
- "result": {"status": "passed",
687
- "duration": 1}},
688
- {"match": {"location": "spec/cucumber/formatter/json_spec.rb:640"},
689
- "result": {"status": "passed",
690
- "duration": 1}}]}]}]})
691
- end
692
- end
693
-
694
- describe 'with a scenario when only an around hook is failing' do
695
- define_feature <<-FEATURE
696
- Feature: Banana party
697
-
698
- Scenario: Monkey eats bananas
699
- Given there are bananas
700
- FEATURE
701
-
702
- define_steps do
703
- Around() { |scenario, block| block.call; raise RuntimeError, 'error' }
704
- Given(/^there are bananas$/) {}
705
- end
706
-
707
- it 'includes the around hook result in the json data' do
708
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
709
- [{"id": "banana-party",
710
- "uri": "spec.feature",
711
- "keyword": "Feature",
712
- "name": "Banana party",
713
- "line": 1,
714
- "description": "",
715
- "elements":
716
- [{"id": "banana-party;monkey-eats-bananas",
717
- "keyword": "Scenario",
718
- "name": "Monkey eats bananas",
719
- "line": 3,
720
- "description": "",
721
- "type": "scenario",
722
- "steps":
723
- [{"keyword": "Given ",
724
- "name": "there are bananas",
725
- "line": 4,
726
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:704"},
727
- "result": {"status": "passed",
728
- "duration": 1}}],
729
- "around":
730
- [{"match": {"location": "unknown_hook_location:1"},
731
- "result": {"status": "failed",
732
- "error_message": "error (RuntimeError)\\n./spec/cucumber/formatter/json_spec.rb:703:in `Around'",
733
- "duration": 1}}]}]}]})
734
- end
735
- end
736
-
737
- describe 'with a scenario with a step with a data table' do
738
- define_feature <<-FEATURE
739
- Feature: Banana party
740
-
741
- Scenario: Monkey eats bananas
742
- Given there are bananas
743
- | aa | bb |
744
- | cc | dd |
745
- FEATURE
746
-
747
- define_steps do
748
- Given(/^there are bananas$/) { |s| s }
749
- end
750
-
751
- it 'includes the doc string in the json data' do
752
- expect(load_normalised_json(@out)).to eq MultiJson.load(%{
753
- [{"id": "banana-party",
754
- "uri": "spec.feature",
755
- "keyword": "Feature",
756
- "name": "Banana party",
757
- "line": 1,
758
- "description": "",
759
- "elements":
760
- [{"id": "banana-party;monkey-eats-bananas",
761
- "keyword": "Scenario",
762
- "name": "Monkey eats bananas",
763
- "line": 3,
764
- "description": "",
765
- "type": "scenario",
766
- "steps":
767
- [{"keyword": "Given ",
768
- "name": "there are bananas",
769
- "line": 4,
770
- "rows":
771
- [{"cells": ["aa", "bb"]},
772
- {"cells": ["cc", "dd"]}],
773
- "match": {"location": "spec/cucumber/formatter/json_spec.rb:748"},
774
- "result": {"status": "passed",
775
- "duration": 1}}]}]}]})
776
- end
777
- end
778
- end
779
-
780
- def load_normalised_json(out)
781
- normalise_json(MultiJson.load(out.string))
782
- end
783
-
784
- def normalise_json(json)
785
- #make sure duration was captured (should be >= 0)
786
- #then set it to what is "expected" since duration is dynamic
787
- json.each do |feature|
788
- elements = feature.fetch('elements') { [] }
789
- elements.each do |scenario|
790
- %w(steps before after around).each do |type|
791
- if scenario[type]
792
- scenario[type].each do |step_or_hook|
793
- normalise_json_step_or_hook(step_or_hook)
794
- if step_or_hook['after']
795
- step_or_hook['after'].each do |hook|
796
- normalise_json_step_or_hook(hook)
797
- end
798
- end
799
- end
800
- end
801
- end
802
- end
803
- end
804
- end
805
-
806
- def normalise_json_step_or_hook(step_or_hook)
807
- return unless step_or_hook['result'] && step_or_hook['result']['duration']
808
-
809
- expect(step_or_hook['result']['duration']).to be >= 0
810
- step_or_hook['result']['duration'] = 1
811
- end
812
-
813
- end
814
- end
815
- end