cucumber 3.0.1 → 3.2.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 (517) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +84 -4
  3. data/CONTRIBUTING.md +3 -4
  4. data/README.md +12 -12
  5. data/lib/autotest/cucumber.rb +1 -0
  6. data/lib/autotest/cucumber_mixin.rb +1 -0
  7. data/lib/autotest/cucumber_rails.rb +1 -0
  8. data/lib/autotest/cucumber_rails_rspec.rb +1 -0
  9. data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
  10. data/lib/autotest/cucumber_rspec.rb +1 -0
  11. data/lib/autotest/cucumber_rspec2.rb +1 -0
  12. data/lib/autotest/discover.rb +1 -0
  13. data/lib/cucumber.rb +1 -0
  14. data/lib/cucumber/cli/configuration.rb +1 -0
  15. data/lib/cucumber/cli/main.rb +2 -2
  16. data/lib/cucumber/cli/options.rb +63 -55
  17. data/lib/cucumber/cli/profile_loader.rb +5 -7
  18. data/lib/cucumber/cli/rerun_file.rb +1 -0
  19. data/lib/cucumber/configuration.rb +8 -7
  20. data/lib/cucumber/constantize.rb +6 -5
  21. data/lib/cucumber/core_ext/string.rb +1 -0
  22. data/lib/cucumber/deprecate.rb +1 -1
  23. data/lib/cucumber/encoding.rb +2 -1
  24. data/lib/cucumber/errors.rb +2 -1
  25. data/lib/cucumber/events.rb +1 -2
  26. data/lib/cucumber/events/gherkin_source_read.rb +1 -4
  27. data/lib/cucumber/events/step_activated.rb +4 -5
  28. data/lib/cucumber/events/step_definition_registered.rb +4 -8
  29. data/lib/cucumber/events/test_case_finished.rb +0 -4
  30. data/lib/cucumber/events/test_case_started.rb +0 -4
  31. data/lib/cucumber/events/test_run_finished.rb +2 -3
  32. data/lib/cucumber/events/test_run_started.rb +2 -4
  33. data/lib/cucumber/events/test_step_finished.rb +0 -6
  34. data/lib/cucumber/events/test_step_started.rb +1 -7
  35. data/lib/cucumber/file_specs.rb +2 -1
  36. data/lib/cucumber/filters.rb +1 -0
  37. data/lib/cucumber/filters/activate_steps.rb +1 -1
  38. data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
  39. data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
  40. data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
  41. data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
  42. data/lib/cucumber/filters/broadcast_test_run_started_event.rb +2 -1
  43. data/lib/cucumber/filters/gated_receiver.rb +1 -2
  44. data/lib/cucumber/filters/prepare_world.rb +2 -5
  45. data/lib/cucumber/filters/quit.rb +2 -4
  46. data/lib/cucumber/filters/randomizer.rb +6 -7
  47. data/lib/cucumber/filters/retry.rb +2 -2
  48. data/lib/cucumber/filters/tag_limits.rb +2 -2
  49. data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -2
  50. data/lib/cucumber/filters/tag_limits/verifier.rb +1 -2
  51. data/lib/cucumber/formatter/ansicolor.rb +13 -12
  52. data/lib/cucumber/formatter/backtrace_filter.rb +1 -2
  53. data/lib/cucumber/formatter/console.rb +11 -12
  54. data/lib/cucumber/formatter/console_counts.rb +4 -4
  55. data/lib/cucumber/formatter/console_issues.rb +3 -3
  56. data/lib/cucumber/formatter/duration.rb +1 -0
  57. data/lib/cucumber/formatter/duration_extractor.rb +1 -1
  58. data/lib/cucumber/formatter/fail_fast.rb +9 -6
  59. data/lib/cucumber/formatter/fanout.rb +1 -3
  60. data/lib/cucumber/formatter/hook_query_visitor.rb +1 -0
  61. data/lib/cucumber/formatter/html.rb +28 -32
  62. data/lib/cucumber/formatter/html_builder.rb +3 -2
  63. data/lib/cucumber/formatter/http_io.rb +146 -0
  64. data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -3
  65. data/lib/cucumber/formatter/interceptor.rb +18 -5
  66. data/lib/cucumber/formatter/io.rb +18 -11
  67. data/lib/cucumber/formatter/json.rb +11 -4
  68. data/lib/cucumber/formatter/json_pretty.rb +1 -1
  69. data/lib/cucumber/formatter/junit.rb +22 -17
  70. data/lib/cucumber/formatter/pretty.rb +4 -3
  71. data/lib/cucumber/formatter/progress.rb +3 -2
  72. data/lib/cucumber/formatter/rerun.rb +2 -1
  73. data/lib/cucumber/formatter/stepdefs.rb +1 -0
  74. data/lib/cucumber/formatter/steps.rb +2 -2
  75. data/lib/cucumber/formatter/summary.rb +1 -2
  76. data/lib/cucumber/formatter/unicode.rb +2 -2
  77. data/lib/cucumber/formatter/usage.rb +22 -19
  78. data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
  79. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +86 -85
  80. data/lib/cucumber/gherkin/formatter/escaping.rb +13 -12
  81. data/lib/cucumber/gherkin/i18n.rb +1 -0
  82. data/lib/cucumber/gherkin/steps_parser.rb +1 -0
  83. data/lib/cucumber/glue/dsl.rb +1 -0
  84. data/lib/cucumber/glue/hook.rb +1 -0
  85. data/lib/cucumber/glue/invoke_in_world.rb +3 -3
  86. data/lib/cucumber/glue/proto_world.rb +10 -9
  87. data/lib/cucumber/glue/registry_and_more.rb +13 -12
  88. data/lib/cucumber/glue/snippet.rb +1 -5
  89. data/lib/cucumber/glue/step_definition.rb +10 -10
  90. data/lib/cucumber/glue/world_factory.rb +1 -3
  91. data/lib/cucumber/hooks.rb +13 -3
  92. data/lib/cucumber/load_path.rb +1 -0
  93. data/lib/cucumber/multiline_argument.rb +3 -3
  94. data/lib/cucumber/multiline_argument/data_table.rb +16 -20
  95. data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +7 -11
  96. data/lib/cucumber/multiline_argument/doc_string.rb +1 -0
  97. data/lib/cucumber/platform.rb +2 -1
  98. data/lib/cucumber/project_initializer.rb +1 -1
  99. data/lib/cucumber/rake/task.rb +8 -5
  100. data/lib/cucumber/rspec/disable_option_parser.rb +1 -0
  101. data/lib/cucumber/rspec/doubles.rb +1 -0
  102. data/lib/cucumber/running_test_case.rb +2 -1
  103. data/lib/cucumber/runtime.rb +6 -6
  104. data/lib/cucumber/runtime/after_hooks.rb +1 -0
  105. data/lib/cucumber/runtime/before_hooks.rb +1 -0
  106. data/lib/cucumber/runtime/for_programming_languages.rb +8 -7
  107. data/lib/cucumber/runtime/step_hooks.rb +2 -0
  108. data/lib/cucumber/runtime/support_code.rb +3 -7
  109. data/lib/cucumber/runtime/user_interface.rb +2 -3
  110. data/lib/cucumber/step_argument.rb +1 -0
  111. data/lib/cucumber/step_definition_light.rb +2 -1
  112. data/lib/cucumber/step_definitions.rb +2 -1
  113. data/lib/cucumber/step_match.rb +9 -8
  114. data/lib/cucumber/step_match_search.rb +8 -9
  115. data/lib/cucumber/term/ansicolor.rb +30 -30
  116. data/lib/cucumber/unit.rb +1 -0
  117. data/lib/cucumber/version +1 -1
  118. data/lib/simplecov_setup.rb +1 -0
  119. metadata +64 -659
  120. data/.coveralls.yml +0 -1
  121. data/.cucumberproignore +0 -6
  122. data/.gitattributes +0 -32
  123. data/.github/ISSUE_TEMPLATE.md +0 -48
  124. data/.github/PULL_REQUEST_TEMPLATE.md +0 -40
  125. data/.rspec +0 -1
  126. data/.rubocop.yml +0 -13
  127. data/.rubocop_todo.yml +0 -991
  128. data/.ruby-gemset +0 -1
  129. data/.travis.yml +0 -70
  130. data/.yardopts +0 -1
  131. data/Gemfile +0 -28
  132. data/Rakefile +0 -32
  133. data/appveyor.yml +0 -27
  134. data/cucumber.gemspec +0 -52
  135. data/cucumber.yml +0 -19
  136. data/examples/i18n/README.textile +0 -3
  137. data/examples/i18n/Rakefile +0 -33
  138. data/examples/i18n/ar/Rakefile +0 -6
  139. data/examples/i18n/ar/features/addition.feature +0 -17
  140. data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +0 -29
  141. data/examples/i18n/ar/lib/calculator.rb +0 -11
  142. data/examples/i18n/bg/Rakefile +0 -6
  143. data/examples/i18n/bg/features/addition.feature +0 -12
  144. data/examples/i18n/bg/features/consecutive_calculations.feature +0 -19
  145. data/examples/i18n/bg/features/division.feature +0 -17
  146. data/examples/i18n/bg/features/step_definitions/calculator_steps.rb +0 -24
  147. data/examples/i18n/bg/features/support/env.rb +0 -10
  148. data/examples/i18n/bg/features/support/world.rb +0 -8
  149. data/examples/i18n/bg/lib/calculator.rb +0 -25
  150. data/examples/i18n/ca/Rakefile +0 -6
  151. data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +0 -26
  152. data/examples/i18n/ca/features/suma.feature +0 -17
  153. data/examples/i18n/ca/lib/calculadora.rb +0 -16
  154. data/examples/i18n/cs/Rakefile +0 -6
  155. data/examples/i18n/cs/features/addition.feature +0 -17
  156. data/examples/i18n/cs/features/division.feature +0 -11
  157. data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +0 -29
  158. data/examples/i18n/cs/lib/calculator.rb +0 -14
  159. data/examples/i18n/da/Rakefile +0 -6
  160. data/examples/i18n/da/features/sammenlaegning.feature +0 -18
  161. data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +0 -29
  162. data/examples/i18n/da/lib/lommeregner.rb +0 -11
  163. data/examples/i18n/de/Rakefile +0 -6
  164. data/examples/i18n/de/features/addition.feature +0 -17
  165. data/examples/i18n/de/features/division.feature +0 -10
  166. data/examples/i18n/de/features/step_definitions/calculator_steps.rb +0 -29
  167. data/examples/i18n/de/lib/calculator.rb +0 -14
  168. data/examples/i18n/el/Rakefile +0 -6
  169. data/examples/i18n/el/features/addition.feature +0 -17
  170. data/examples/i18n/el/features/division.feature +0 -10
  171. data/examples/i18n/el/features/step_definitions/calculator_steps.rb +0 -29
  172. data/examples/i18n/el/lib/calculator.rb +0 -14
  173. data/examples/i18n/en-lol/Rakefile +0 -4
  174. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +0 -16
  175. data/examples/i18n/en-lol/features/stuffing.feature +0 -8
  176. data/examples/i18n/en-lol/features/support/env.rb +0 -11
  177. data/examples/i18n/en-lol/lib/basket.rb +0 -12
  178. data/examples/i18n/en-lol/lib/belly.rb +0 -11
  179. data/examples/i18n/en/Rakefile +0 -6
  180. data/examples/i18n/en/features/addition.feature +0 -17
  181. data/examples/i18n/en/features/division.feature +0 -10
  182. data/examples/i18n/en/features/step_definitions/calculator_steps.rb +0 -29
  183. data/examples/i18n/en/lib/calculator.rb +0 -14
  184. data/examples/i18n/eo/Rakefile +0 -6
  185. data/examples/i18n/eo/features/adicio.feature +0 -17
  186. data/examples/i18n/eo/features/divido.feature +0 -10
  187. data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +0 -29
  188. data/examples/i18n/eo/lib/calculator.rb +0 -14
  189. data/examples/i18n/es/Rakefile +0 -6
  190. data/examples/i18n/es/features/adicion.feature +0 -17
  191. data/examples/i18n/es/features/step_definitions/calculador_steps.rb +0 -26
  192. data/examples/i18n/es/lib/calculador.rb +0 -14
  193. data/examples/i18n/et/Rakefile +0 -6
  194. data/examples/i18n/et/features/jagamine.feature +0 -10
  195. data/examples/i18n/et/features/liitmine.feature +0 -17
  196. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +0 -29
  197. data/examples/i18n/et/lib/kalkulaator.rb +0 -14
  198. data/examples/i18n/fi/Rakefile +0 -6
  199. data/examples/i18n/fi/features/jakolasku.feature +0 -10
  200. data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +0 -29
  201. data/examples/i18n/fi/features/yhteenlasku.feature +0 -17
  202. data/examples/i18n/fi/lib/laskin.rb +0 -14
  203. data/examples/i18n/fr/Rakefile +0 -8
  204. data/examples/i18n/fr/features/addition.feature +0 -18
  205. data/examples/i18n/fr/features/addition2.feature +0 -17
  206. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +0 -32
  207. data/examples/i18n/fr/features/support/env.rb +0 -10
  208. data/examples/i18n/fr/lib/calculatrice.rb +0 -10
  209. data/examples/i18n/he/Rakefile +0 -6
  210. data/examples/i18n/he/features/addition.feature +0 -17
  211. data/examples/i18n/he/features/division.feature +0 -10
  212. data/examples/i18n/he/features/step_definitions/calculator_steps.rb +0 -29
  213. data/examples/i18n/he/lib/calculator.rb +0 -15
  214. data/examples/i18n/hi/Rakefile +0 -6
  215. data/examples/i18n/hi/features/addition.feature +0 -16
  216. data/examples/i18n/hi/features/division.feature +0 -10
  217. data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +0 -29
  218. data/examples/i18n/hi/lib/calculator.rb +0 -15
  219. data/examples/i18n/ht/Rakefile +0 -6
  220. data/examples/i18n/ht/features/adisyon.feature +0 -17
  221. data/examples/i18n/ht/features/divizyon.feature +0 -10
  222. data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +0 -29
  223. data/examples/i18n/ht/lib/kalkilatris.rb +0 -14
  224. data/examples/i18n/hu/Rakefile +0 -6
  225. data/examples/i18n/hu/features/osszeadas.feature +0 -17
  226. data/examples/i18n/hu/features/osztas.feature +0 -10
  227. data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +0 -30
  228. data/examples/i18n/hu/lib/calculator.rb +0 -14
  229. data/examples/i18n/id/Rakefile +0 -6
  230. data/examples/i18n/id/features/addition.feature +0 -17
  231. data/examples/i18n/id/features/division.feature +0 -10
  232. data/examples/i18n/id/features/step_definitions/calculator_steps.rb +0 -29
  233. data/examples/i18n/id/lib/calculator.rb +0 -14
  234. data/examples/i18n/it/Rakefile +0 -6
  235. data/examples/i18n/it/features/somma.feature +0 -11
  236. data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +0 -29
  237. data/examples/i18n/it/lib/calcolatrice.rb +0 -11
  238. data/examples/i18n/ja/Rakefile +0 -6
  239. data/examples/i18n/ja/features/addition.feature +0 -17
  240. data/examples/i18n/ja/features/division.feature +0 -10
  241. data/examples/i18n/ja/features/step_definitions/calculator_steps.rb +0 -19
  242. data/examples/i18n/ja/features/support/env.rb +0 -10
  243. data/examples/i18n/ja/lib/calculator.rb +0 -14
  244. data/examples/i18n/ko/Rakefile +0 -6
  245. data/examples/i18n/ko/features/addition.feature +0 -17
  246. data/examples/i18n/ko/features/division.feature +0 -11
  247. data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +0 -29
  248. data/examples/i18n/ko/lib/calculator.rb +0 -14
  249. data/examples/i18n/lt/Rakefile +0 -6
  250. data/examples/i18n/lt/features/addition.feature +0 -17
  251. data/examples/i18n/lt/features/division.feature +0 -10
  252. data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +0 -29
  253. data/examples/i18n/lt/lib/calculator.rb +0 -14
  254. data/examples/i18n/lv/Rakefile +0 -6
  255. data/examples/i18n/lv/features/addition.feature +0 -17
  256. data/examples/i18n/lv/features/division.feature +0 -10
  257. data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +0 -29
  258. data/examples/i18n/lv/lib/calculator.rb +0 -14
  259. data/examples/i18n/no/Rakefile +0 -6
  260. data/examples/i18n/no/features/step_definitions/kalkulator_steps.rb +0 -17
  261. data/examples/i18n/no/features/summering.feature +0 -19
  262. data/examples/i18n/no/features/support/env.rb +0 -11
  263. data/examples/i18n/no/lib/kalkulator.rb +0 -11
  264. data/examples/i18n/pl/Rakefile +0 -6
  265. data/examples/i18n/pl/features/addition.feature +0 -17
  266. data/examples/i18n/pl/features/division.feature +0 -10
  267. data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +0 -29
  268. data/examples/i18n/pl/features/support/env.rb +0 -10
  269. data/examples/i18n/pl/lib/calculator.rb +0 -14
  270. data/examples/i18n/pt/Rakefile +0 -6
  271. data/examples/i18n/pt/features/adicao.feature +0 -11
  272. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +0 -20
  273. data/examples/i18n/pt/features/support/env.rb +0 -10
  274. data/examples/i18n/pt/lib/calculadora.rb +0 -10
  275. data/examples/i18n/ro/Rakefile +0 -6
  276. data/examples/i18n/ro/features/adunare.feature +0 -12
  277. data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +0 -26
  278. data/examples/i18n/ro/lib/calculator.rb +0 -11
  279. data/examples/i18n/ru/Rakefile +0 -6
  280. data/examples/i18n/ru/features/addition.feature +0 -11
  281. data/examples/i18n/ru/features/consecutive_calculations.feature +0 -17
  282. data/examples/i18n/ru/features/division.feature +0 -16
  283. data/examples/i18n/ru/features/step_definitions/calculator_steps.rb +0 -19
  284. data/examples/i18n/ru/features/support/env.rb +0 -10
  285. data/examples/i18n/ru/features/support/world.rb +0 -8
  286. data/examples/i18n/ru/lib/calculator.rb +0 -25
  287. data/examples/i18n/sk/Rakefile +0 -6
  288. data/examples/i18n/sk/features/addition.feature +0 -17
  289. data/examples/i18n/sk/features/division.feature +0 -10
  290. data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +0 -29
  291. data/examples/i18n/sk/lib/calculator.rb +0 -14
  292. data/examples/i18n/sr-Cyrl/Rakefile +0 -6
  293. data/examples/i18n/sr-Cyrl/features/sabiranje.feature +0 -18
  294. data/examples/i18n/sr-Cyrl/features/step_definitions/calculator_steps.rb +0 -20
  295. data/examples/i18n/sr-Cyrl/features/support/env.rb +0 -10
  296. data/examples/i18n/sr-Cyrl/lib/calculator.rb +0 -12
  297. data/examples/i18n/sr-Latn/Rakefile +0 -6
  298. data/examples/i18n/sr-Latn/features/sabiranje.feature +0 -18
  299. data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +0 -29
  300. data/examples/i18n/sr-Latn/lib/calculator.rb +0 -12
  301. data/examples/i18n/sv/Rakefile +0 -6
  302. data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +0 -29
  303. data/examples/i18n/sv/features/summering.feature +0 -18
  304. data/examples/i18n/sv/lib/kalkulator.rb +0 -11
  305. data/examples/i18n/tr/Rakefile +0 -6
  306. data/examples/i18n/tr/features/bolme.feature +0 -10
  307. data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +0 -29
  308. data/examples/i18n/tr/features/toplama.feature +0 -18
  309. data/examples/i18n/tr/lib/hesap_makinesi.rb +0 -15
  310. data/examples/i18n/uk/Rakefile +0 -6
  311. data/examples/i18n/uk/features/addition.feature +0 -11
  312. data/examples/i18n/uk/features/consecutive_calculations.feature +0 -17
  313. data/examples/i18n/uk/features/division.feature +0 -16
  314. data/examples/i18n/uk/features/step_definitions/calculator_steps.rb +0 -19
  315. data/examples/i18n/uk/features/support/env.rb +0 -10
  316. data/examples/i18n/uk/features/support/world.rb +0 -8
  317. data/examples/i18n/uk/lib/calculator.rb +0 -25
  318. data/examples/i18n/uz/Rakefile +0 -6
  319. data/examples/i18n/uz/features/addition.feature +0 -10
  320. data/examples/i18n/uz/features/consecutive_calculations.feature +0 -17
  321. data/examples/i18n/uz/features/division.feature +0 -17
  322. data/examples/i18n/uz/features/step_definitions/calculator_steps.rb +0 -19
  323. data/examples/i18n/uz/features/support/env.rb +0 -10
  324. data/examples/i18n/uz/features/support/world.rb +0 -8
  325. data/examples/i18n/uz/lib/calculator.rb +0 -25
  326. data/examples/i18n/zh-CN/Rakefile +0 -4
  327. data/examples/i18n/zh-CN/features/addition.feature +0 -18
  328. data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +0 -31
  329. data/examples/i18n/zh-CN/lib/calculator.rb +0 -10
  330. data/examples/i18n/zh-TW/Rakefile +0 -4
  331. data/examples/i18n/zh-TW/features/addition.feature +0 -17
  332. data/examples/i18n/zh-TW/features/division.feature +0 -11
  333. data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +0 -29
  334. data/examples/i18n/zh-TW/lib/calculator.rb +0 -14
  335. data/examples/rspec_doubles/Rakefile +0 -4
  336. data/examples/rspec_doubles/features/mocking.feature +0 -9
  337. data/examples/rspec_doubles/features/step_definitions/calvin_steps.rb +0 -19
  338. data/examples/rspec_doubles/features/support/env.rb +0 -12
  339. data/examples/sinatra/README.textile +0 -13
  340. data/examples/sinatra/Rakefile +0 -6
  341. data/examples/sinatra/app.rb +0 -14
  342. data/examples/sinatra/features/add.feature +0 -11
  343. data/examples/sinatra/features/step_definitions/add_steps.rb +0 -15
  344. data/examples/sinatra/features/support/env.rb +0 -15
  345. data/examples/sinatra/views/add.erb +0 -7
  346. data/examples/sinatra/views/layout.erb +0 -8
  347. data/examples/tcl/README.textile +0 -11
  348. data/examples/tcl/Rakefile +0 -6
  349. data/examples/tcl/features/fibonnacci.feature +0 -17
  350. data/examples/tcl/features/step_definitions/fib_steps.rb +0 -7
  351. data/examples/tcl/features/support/env.rb +0 -7
  352. data/examples/tcl/src/fib.tcl +0 -3
  353. data/examples/test_unit/Gemfile +0 -4
  354. data/examples/test_unit/Rakefile +0 -6
  355. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +0 -20
  356. data/examples/test_unit/features/test_unit.feature +0 -9
  357. data/examples/watir/README.textile +0 -16
  358. data/examples/watir/Rakefile +0 -12
  359. data/examples/watir/cucumber.yml +0 -1
  360. data/examples/watir/features/search.feature +0 -12
  361. data/examples/watir/features/step_definitions/search_steps.rb +0 -27
  362. data/examples/watir/features/support/env.rb +0 -39
  363. data/examples/watir/features/support/screenshots.rb +0 -47
  364. data/features/docs/api/list_step_defs_as_json.feature +0 -64
  365. data/features/docs/api/listen_for_events.feature +0 -59
  366. data/features/docs/api/run_cli_main_with_existing_runtime.feature +0 -27
  367. data/features/docs/cli/backtraces.feature +0 -36
  368. data/features/docs/cli/dry_run.feature +0 -73
  369. data/features/docs/cli/exclude_files.feature +0 -18
  370. data/features/docs/cli/execute_with_tag_filter.feature +0 -119
  371. data/features/docs/cli/fail_fast.feature +0 -48
  372. data/features/docs/cli/finding_steps.feature +0 -28
  373. data/features/docs/cli/help.feature +0 -8
  374. data/features/docs/cli/i18n.feature +0 -42
  375. data/features/docs/cli/randomize.feature +0 -140
  376. data/features/docs/cli/require.feature +0 -27
  377. data/features/docs/cli/retry_failing_tests.feature +0 -92
  378. data/features/docs/cli/run_scenarios_matching_name.feature +0 -105
  379. data/features/docs/cli/run_specific_scenarios.feature +0 -77
  380. data/features/docs/cli/showing_differences.feature +0 -43
  381. data/features/docs/cli/specifying_multiple_formatters.feature +0 -68
  382. data/features/docs/cli/strict_mode.feature +0 -70
  383. data/features/docs/defining_steps/ambiguous_steps.feature +0 -89
  384. data/features/docs/defining_steps/nested_steps.feature +0 -181
  385. data/features/docs/defining_steps/nested_steps_i18n.feature +0 -37
  386. data/features/docs/defining_steps/nested_steps_with_second_arg.feature +0 -56
  387. data/features/docs/defining_steps/one_line_step_definitions.feature +0 -65
  388. data/features/docs/defining_steps/printing_messages.feature +0 -147
  389. data/features/docs/defining_steps/skip_scenario.feature +0 -31
  390. data/features/docs/defining_steps/snippets.feature +0 -56
  391. data/features/docs/defining_steps/table_diffing.feature +0 -50
  392. data/features/docs/events/gherkin_source_read_event.feature +0 -43
  393. data/features/docs/events/step_activated_event.feature +0 -36
  394. data/features/docs/events/step_definition_registered_event.feature +0 -29
  395. data/features/docs/events/test_case_finished_event.feature +0 -35
  396. data/features/docs/events/test_case_started_event.feature +0 -54
  397. data/features/docs/events/test_run_finished_event.feature +0 -40
  398. data/features/docs/events/test_run_started_event.feature +0 -41
  399. data/features/docs/events/test_step_finished_event.feature +0 -47
  400. data/features/docs/events/test_step_started_event.feature +0 -43
  401. data/features/docs/exception_in_after_hook.feature +0 -127
  402. data/features/docs/exception_in_after_step_hook.feature +0 -104
  403. data/features/docs/exception_in_around_hook.feature +0 -80
  404. data/features/docs/exception_in_before_hook.feature +0 -98
  405. data/features/docs/extending_cucumber/custom_filter.feature +0 -29
  406. data/features/docs/extending_cucumber/custom_formatter.feature +0 -94
  407. data/features/docs/formatters/api_methods.feature +0 -37
  408. data/features/docs/formatters/html_formatter.feature +0 -91
  409. data/features/docs/formatters/json_formatter.feature +0 -767
  410. data/features/docs/formatters/junit_formatter.feature +0 -455
  411. data/features/docs/formatters/pretty_formatter.feature +0 -74
  412. data/features/docs/formatters/progress_formatter.feature +0 -32
  413. data/features/docs/formatters/rerun_formatter.feature +0 -190
  414. data/features/docs/formatters/summary_formatter.feature +0 -35
  415. data/features/docs/formatters/usage_formatter.feature +0 -101
  416. data/features/docs/getting_started.feature +0 -28
  417. data/features/docs/gherkin/background.feature +0 -548
  418. data/features/docs/gherkin/doc_strings.feature +0 -76
  419. data/features/docs/gherkin/expand_option_for_outlines.feature +0 -47
  420. data/features/docs/gherkin/language_from_header.feature +0 -32
  421. data/features/docs/gherkin/outlines.feature +0 -158
  422. data/features/docs/gherkin/unicode_table.feature +0 -33
  423. data/features/docs/gherkin/using_descriptions.feature +0 -83
  424. data/features/docs/gherkin/using_star_notation.feature +0 -37
  425. data/features/docs/iso-8859-1.feature +0 -6
  426. data/features/docs/post_configuration_hook.feature +0 -33
  427. data/features/docs/profiles.feature +0 -120
  428. data/features/docs/rake_task.feature +0 -146
  429. data/features/docs/raketask.feature +0 -46
  430. data/features/docs/work_in_progress.feature +0 -157
  431. data/features/docs/writing_support_code/after_hooks.feature +0 -102
  432. data/features/docs/writing_support_code/after_step_hooks.feature +0 -55
  433. data/features/docs/writing_support_code/around_hooks.feature +0 -266
  434. data/features/docs/writing_support_code/before_hook.feature +0 -66
  435. data/features/docs/writing_support_code/hook_order.feature +0 -63
  436. data/features/docs/writing_support_code/load_path.feature +0 -17
  437. data/features/docs/writing_support_code/parameter_types.feature +0 -69
  438. data/features/docs/writing_support_code/state.feature +0 -32
  439. data/features/docs/writing_support_code/tagged_hooks.feature +0 -95
  440. data/features/docs/writing_support_code/world.feature +0 -129
  441. data/features/lib/step_definitions/aruba_steps.rb +0 -21
  442. data/features/lib/step_definitions/cli_steps.rb +0 -4
  443. data/features/lib/step_definitions/cucumber_steps.rb +0 -75
  444. data/features/lib/step_definitions/iso-8859-1_steps.rb +0 -16
  445. data/features/lib/step_definitions/json_steps.rb +0 -8
  446. data/features/lib/step_definitions/junit_steps.rb +0 -14
  447. data/features/lib/step_definitions/language_steps.rb +0 -9
  448. data/features/lib/step_definitions/profile_steps.rb +0 -16
  449. data/features/lib/step_definitions/retry_steps.rb +0 -55
  450. data/features/lib/step_definitions/ruby_steps.rb +0 -4
  451. data/features/lib/support/env.rb +0 -22
  452. data/features/lib/support/fake_wire_server.rb +0 -94
  453. data/features/lib/support/feature_factory.rb +0 -68
  454. data/features/lib/support/normalise_output.rb +0 -52
  455. data/features/lib/support/parameter_types.rb +0 -5
  456. data/gem_tasks/contributors.rake +0 -19
  457. data/gem_tasks/cov.rake +0 -6
  458. data/gem_tasks/downloads.rb +0 -8
  459. data/gem_tasks/environment.rake +0 -4
  460. data/gem_tasks/examples.rake +0 -12
  461. data/gem_tasks/fix_cr_lf.rake +0 -22
  462. data/gem_tasks/flog.rake +0 -5
  463. data/gem_tasks/rspec.rake +0 -7
  464. data/gem_tasks/sass.rake +0 -5
  465. data/gem_tasks/stats +0 -16
  466. data/gem_tasks/versions.txt +0 -74
  467. data/scripts/invite-collaborator +0 -40
  468. data/scripts/update-changelog +0 -86
  469. data/spec/cucumber/cli/configuration_spec.rb +0 -446
  470. data/spec/cucumber/cli/main_spec.rb +0 -84
  471. data/spec/cucumber/cli/options_spec.rb +0 -445
  472. data/spec/cucumber/cli/profile_loader_spec.rb +0 -66
  473. data/spec/cucumber/cli/rerun_spec.rb +0 -86
  474. data/spec/cucumber/configuration_spec.rb +0 -148
  475. data/spec/cucumber/constantize_spec.rb +0 -20
  476. data/spec/cucumber/events_spec.rb +0 -9
  477. data/spec/cucumber/file_specs_spec.rb +0 -61
  478. data/spec/cucumber/filters/activate_steps_spec.rb +0 -152
  479. data/spec/cucumber/filters/gated_receiver_spec.rb +0 -48
  480. data/spec/cucumber/filters/retry_spec.rb +0 -98
  481. data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +0 -39
  482. data/spec/cucumber/filters/tag_limits/verifier_spec.rb +0 -58
  483. data/spec/cucumber/filters/tag_limits_spec.rb +0 -60
  484. data/spec/cucumber/formatter/ansicolor_spec.rb +0 -33
  485. data/spec/cucumber/formatter/backtrace_filter_spec.rb +0 -32
  486. data/spec/cucumber/formatter/console_counts_spec.rb +0 -14
  487. data/spec/cucumber/formatter/duration_spec.rb +0 -23
  488. data/spec/cucumber/formatter/fail_fast_spec.rb +0 -88
  489. data/spec/cucumber/formatter/html_spec.rb +0 -543
  490. data/spec/cucumber/formatter/interceptor_spec.rb +0 -137
  491. data/spec/cucumber/formatter/json_spec.rb +0 -815
  492. data/spec/cucumber/formatter/junit_spec.rb +0 -251
  493. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +0 -2175
  494. data/spec/cucumber/formatter/pretty_spec.rb +0 -907
  495. data/spec/cucumber/formatter/progress_spec.rb +0 -170
  496. data/spec/cucumber/formatter/rerun_spec.rb +0 -97
  497. data/spec/cucumber/formatter/spec_helper.rb +0 -84
  498. data/spec/cucumber/glue/proto_world_spec.rb +0 -63
  499. data/spec/cucumber/glue/registry_and_more_spec.rb +0 -213
  500. data/spec/cucumber/glue/snippet_spec.rb +0 -174
  501. data/spec/cucumber/glue/step_definition_spec.rb +0 -207
  502. data/spec/cucumber/hooks_spec.rb +0 -31
  503. data/spec/cucumber/multiline_argument/data_table_spec.rb +0 -653
  504. data/spec/cucumber/project_initializer_spec.rb +0 -88
  505. data/spec/cucumber/rake/forked_spec.rb +0 -58
  506. data/spec/cucumber/rake/task_spec.rb +0 -86
  507. data/spec/cucumber/running_test_case_spec.rb +0 -140
  508. data/spec/cucumber/runtime/for_programming_languages_spec.rb +0 -8
  509. data/spec/cucumber/runtime/support_code_spec.rb +0 -17
  510. data/spec/cucumber/runtime_spec.rb +0 -21
  511. data/spec/cucumber/sell_cucumbers.feature +0 -19
  512. data/spec/cucumber/step_argument_spec.rb +0 -19
  513. data/spec/cucumber/step_match_search_spec.rb +0 -113
  514. data/spec/cucumber/step_match_spec.rb +0 -86
  515. data/spec/cucumber/world/pending_spec.rb +0 -48
  516. data/spec/spec_helper.rb +0 -30
  517. data/spec/support/standard_step_actions.rb +0 -19
@@ -1,137 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
- require 'cucumber/formatter/interceptor'
4
-
5
- module Cucumber::Formatter
6
- describe Interceptor::Pipe do
7
- let(:pipe) do
8
- pipe = double('original pipe')
9
-
10
- allow(pipe).to receive(:instance_of?) { true }
11
-
12
- pipe
13
- end
14
-
15
- describe '#wrap!' do
16
- it 'raises an ArgumentError if its not passed :stderr/:stdout' do
17
- expect {
18
- Interceptor::Pipe.wrap(:nonsense)
19
- }.to raise_error(ArgumentError)
20
- end
21
-
22
- context 'when passed :stderr' do
23
- before :each do
24
- @stderr = $stdout
25
- end
26
-
27
- it 'wraps $stderr' do
28
- wrapped = Interceptor::Pipe.wrap(:stderr)
29
-
30
- expect($stderr).to be_instance_of Interceptor::Pipe
31
- expect($stderr).to be wrapped
32
- end
33
-
34
- after :each do
35
- $stderr = @stderr
36
- end
37
- end
38
-
39
- context 'when passed :stdout' do
40
- before :each do
41
- @stdout = $stdout
42
- end
43
-
44
- it 'wraps $stdout' do
45
- wrapped = Interceptor::Pipe.wrap(:stdout)
46
-
47
- expect($stdout).to be_instance_of Interceptor::Pipe
48
- expect($stdout).to be wrapped
49
- end
50
-
51
- after :each do
52
- $stdout = @stdout
53
- end
54
- end
55
- end
56
-
57
- describe '#unwrap!' do
58
- before :each do
59
- @stdout = $stdout
60
- @wrapped = Interceptor::Pipe.wrap(:stdout)
61
- end
62
-
63
- it 'raises an ArgumentError if it wasn\'t passed :stderr/:stdout' do
64
- expect {
65
- Interceptor::Pipe.unwrap!(:nonsense)
66
- }.to raise_error(ArgumentError)
67
- end
68
-
69
- it 'resets $stdout when #unwrap! is called' do
70
- interceptor = Interceptor::Pipe.unwrap! :stdout
71
-
72
- expect(interceptor).to be_instance_of Interceptor::Pipe
73
- expect($stdout).not_to be interceptor
74
- end
75
-
76
- it 'noops if $stdout or $stderr has been overwritten' do
77
- $stdout = StringIO.new
78
- pipe = Interceptor::Pipe.unwrap! :stdout
79
- expect(pipe).to eq $stdout
80
-
81
- $stderr = StringIO.new
82
- pipe = Interceptor::Pipe.unwrap! :stderr
83
- expect(pipe).to eq $stderr
84
- end
85
-
86
- it 'disables the pipe bypass' do
87
- buffer = '(::)'
88
- Interceptor::Pipe.unwrap! :stdout
89
-
90
- expect(@wrapped).to receive(:write).with(buffer)
91
- expect(@wrapped.buffer).not_to receive(:<<)
92
-
93
- @wrapped.write(buffer)
94
- end
95
-
96
- after :each do
97
- $stdout = @stdout
98
- end
99
- end
100
-
101
- describe '#write' do
102
- let(:buffer) { 'Some stupid buffer' }
103
- let(:pi) { Interceptor::Pipe.new(pipe) }
104
-
105
- it 'writes arguments to the original pipe' do
106
- expect(pipe).to receive(:write).with(buffer) { buffer.size }
107
- expect(pi.write(buffer)).to eq buffer.size
108
- end
109
-
110
- it 'adds the buffer to its stored output' do
111
- allow(pipe).to receive(:write)
112
-
113
- pi.write(buffer)
114
-
115
- expect(pi.buffer).not_to be_empty
116
- expect(pi.buffer.first).to eq buffer
117
- end
118
- end
119
-
120
- describe '#method_missing' do
121
- let(:pi) { Interceptor::Pipe.new(pipe) }
122
-
123
- it 'passes #tty? to the original pipe' do
124
- expect(pipe).to receive(:tty?) { true }
125
- expect(pi.tty?).to be true
126
- end
127
- end
128
-
129
- describe '#respond_to' do
130
- let(:pi) { Interceptor::Pipe.wrap(:stderr) }
131
-
132
- it 'responds to all methods $stderr has' do
133
- $stderr.methods.each { |m| expect(pi.respond_to?(m)).to be true }
134
- end
135
- end
136
- end
137
- end
@@ -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