cucumber 2.99.0 → 3.0.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 (395) hide show
  1. checksums.yaml +4 -4
  2. data/.cucumberproignore +6 -0
  3. data/.gitattributes +32 -0
  4. data/.github/ISSUE_TEMPLATE.md +1 -1
  5. data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  6. data/.rubocop.yml +13 -0
  7. data/.rubocop_todo.yml +991 -0
  8. data/.travis.yml +56 -10
  9. data/{History.md → CHANGELOG.md} +166 -32
  10. data/CONTRIBUTING.md +21 -1
  11. data/Gemfile +18 -5
  12. data/README.md +13 -4
  13. data/Rakefile +12 -2
  14. data/appveyor.yml +27 -0
  15. data/bin/cucumber +2 -1
  16. data/cucumber.gemspec +15 -10
  17. data/cucumber.yml +10 -11
  18. data/examples/i18n/Rakefile +1 -1
  19. data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +8 -3
  20. data/examples/i18n/ar/lib/calculator.rb +2 -2
  21. data/examples/i18n/bg/features/step_definitions/calculator_steps.rb +6 -6
  22. data/examples/i18n/bg/features/support/env.rb +6 -1
  23. data/examples/i18n/bg/lib/calculator.rb +2 -1
  24. data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +10 -5
  25. data/examples/i18n/ca/lib/calculadora.rb +2 -2
  26. data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +10 -5
  27. data/examples/i18n/cs/lib/calculator.rb +3 -3
  28. data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +10 -5
  29. data/examples/i18n/da/lib/lommeregner.rb +2 -2
  30. data/examples/i18n/de/features/step_definitions/calculator_steps.rb +10 -5
  31. data/examples/i18n/de/lib/calculator.rb +2 -2
  32. data/examples/i18n/el/features/step_definitions/calculator_steps.rb +10 -5
  33. data/examples/i18n/el/lib/calculator.rb +2 -2
  34. data/examples/i18n/en/features/step_definitions/calculator_steps.rb +9 -4
  35. data/examples/i18n/en/lib/calculator.rb +2 -2
  36. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +4 -4
  37. data/examples/i18n/en-lol/features/support/env.rb +6 -2
  38. data/examples/i18n/en-lol/lib/basket.rb +2 -2
  39. data/examples/i18n/en-lol/lib/belly.rb +2 -2
  40. data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +9 -4
  41. data/examples/i18n/eo/lib/calculator.rb +2 -2
  42. data/examples/i18n/es/features/step_definitions/calculador_steps.rb +10 -5
  43. data/examples/i18n/es/lib/calculador.rb +2 -2
  44. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +10 -5
  45. data/examples/i18n/et/lib/kalkulaator.rb +3 -3
  46. data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +9 -4
  47. data/examples/i18n/fi/lib/laskin.rb +1 -1
  48. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +8 -8
  49. data/examples/i18n/fr/features/support/env.rb +7 -2
  50. data/examples/i18n/fr/lib/calculatrice.rb +2 -2
  51. data/examples/i18n/he/features/step_definitions/calculator_steps.rb +10 -5
  52. data/examples/i18n/he/lib/calculator.rb +1 -1
  53. data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +9 -4
  54. data/examples/i18n/hi/lib/calculator.rb +1 -1
  55. data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +9 -5
  56. data/examples/i18n/ht/lib/kalkilatris.rb +2 -2
  57. data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +10 -5
  58. data/examples/i18n/hu/lib/calculator.rb +1 -1
  59. data/examples/i18n/id/features/step_definitions/calculator_steps.rb +10 -5
  60. data/examples/i18n/id/lib/calculator.rb +2 -2
  61. data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +10 -5
  62. data/examples/i18n/it/lib/calcolatrice.rb +3 -3
  63. data/examples/i18n/ja/features/step_definitions/calculator_steps.rb +3 -3
  64. data/examples/i18n/ja/features/support/env.rb +7 -2
  65. data/examples/i18n/ja/lib/calculator.rb +2 -2
  66. data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +10 -5
  67. data/examples/i18n/ko/lib/calculator.rb +2 -2
  68. data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +10 -5
  69. data/examples/i18n/lt/lib/calculator.rb +2 -2
  70. data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +10 -5
  71. data/examples/i18n/lv/lib/calculator.rb +2 -2
  72. data/examples/i18n/no/features/step_definitions/kalkulator_steps.rb +3 -3
  73. data/examples/i18n/no/features/support/env.rb +7 -2
  74. data/examples/i18n/no/lib/kalkulator.rb +2 -2
  75. data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +10 -5
  76. data/examples/i18n/pl/features/support/env.rb +6 -1
  77. data/examples/i18n/pl/lib/calculator.rb +2 -2
  78. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +3 -3
  79. data/examples/i18n/pt/features/support/env.rb +7 -2
  80. data/examples/i18n/pt/lib/calculadora.rb +1 -1
  81. data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +11 -6
  82. data/examples/i18n/ro/lib/calculator.rb +1 -1
  83. data/examples/i18n/ru/features/step_definitions/calculator_steps.rb +5 -5
  84. data/examples/i18n/ru/features/support/env.rb +6 -1
  85. data/examples/i18n/ru/lib/calculator.rb +2 -1
  86. data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +10 -5
  87. data/examples/i18n/sk/lib/calculator.rb +2 -2
  88. data/examples/i18n/sr-Cyrl/features/step_definitions/calculator_steps.rb +3 -3
  89. data/examples/i18n/sr-Cyrl/features/support/env.rb +7 -2
  90. data/examples/i18n/sr-Cyrl/lib/calculator.rb +2 -2
  91. data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +10 -5
  92. data/examples/i18n/sr-Latn/lib/calculator.rb +2 -2
  93. data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +9 -4
  94. data/examples/i18n/sv/lib/kalkulator.rb +2 -2
  95. data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +10 -5
  96. data/examples/i18n/tr/lib/hesap_makinesi.rb +2 -2
  97. data/examples/i18n/uk/features/step_definitions/calculator_steps.rb +4 -4
  98. data/examples/i18n/uk/features/support/env.rb +6 -1
  99. data/examples/i18n/uk/lib/calculator.rb +2 -1
  100. data/examples/i18n/uz/features/step_definitions/calculator_steps.rb +4 -4
  101. data/examples/i18n/uz/features/support/env.rb +6 -1
  102. data/examples/i18n/uz/lib/calculator.rb +2 -1
  103. data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +11 -6
  104. data/examples/i18n/zh-CN/lib/calculator.rb +2 -2
  105. data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +10 -5
  106. data/examples/i18n/zh-TW/lib/calculator.rb +2 -2
  107. data/examples/rspec_doubles/features/step_definitions/calvin_steps.rb +3 -3
  108. data/examples/sinatra/features/step_definitions/add_steps.rb +4 -4
  109. data/examples/sinatra/features/support/env.rb +6 -1
  110. data/examples/tcl/features/step_definitions/fib_steps.rb +2 -2
  111. data/examples/tcl/features/support/env.rb +2 -1
  112. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +4 -4
  113. data/examples/watir/features/step_definitions/search_steps.rb +6 -5
  114. data/examples/watir/features/support/env.rb +5 -1
  115. data/examples/watir/features/support/screenshots.rb +5 -5
  116. data/features/docs/api/list_step_defs_as_json.feature +21 -7
  117. data/features/docs/api/listen_for_events.feature +9 -8
  118. data/features/docs/api/run_cli_main_with_existing_runtime.feature +1 -0
  119. data/features/docs/cli/dry_run.feature +3 -0
  120. data/features/docs/cli/execute_with_tag_filter.feature +8 -6
  121. data/features/docs/cli/fail_fast.feature +2 -0
  122. data/features/docs/cli/help.feature +8 -0
  123. data/features/docs/{gherkin/language_help.feature → cli/i18n.feature} +6 -6
  124. data/features/docs/cli/randomize.feature +2 -2
  125. data/features/docs/cli/retry_failing_tests.feature +75 -15
  126. data/features/docs/cli/run_scenarios_matching_name.feature +1 -0
  127. data/features/docs/cli/specifying_multiple_formatters.feature +3 -0
  128. data/features/docs/cli/strict_mode.feature +6 -0
  129. data/features/docs/defining_steps/ambiguous_steps.feature +89 -0
  130. data/features/docs/defining_steps/nested_steps.feature +5 -1
  131. data/features/docs/defining_steps/nested_steps_i18n.feature +3 -0
  132. data/features/docs/defining_steps/nested_steps_with_second_arg.feature +2 -0
  133. data/features/docs/defining_steps/printing_messages.feature +1 -2
  134. data/features/docs/defining_steps/skip_scenario.feature +1 -34
  135. data/features/docs/defining_steps/snippets.feature +18 -18
  136. data/features/docs/events/gherkin_source_read_event.feature +43 -0
  137. data/features/docs/events/step_activated_event.feature +36 -0
  138. data/features/docs/events/step_definition_registered_event.feature +29 -0
  139. data/features/docs/events/test_case_finished_event.feature +35 -0
  140. data/features/docs/events/test_case_started_event.feature +54 -0
  141. data/features/docs/events/test_run_finished_event.feature +40 -0
  142. data/features/docs/events/test_run_started_event.feature +41 -0
  143. data/features/docs/events/test_step_finished_event.feature +47 -0
  144. data/features/docs/events/test_step_started_event.feature +43 -0
  145. data/features/docs/exception_in_after_hook.feature +3 -2
  146. data/features/docs/exception_in_after_step_hook.feature +2 -0
  147. data/features/docs/exception_in_around_hook.feature +2 -0
  148. data/features/docs/exception_in_before_hook.feature +3 -1
  149. data/features/docs/extending_cucumber/custom_formatter.feature +12 -48
  150. data/features/docs/formatters/json_formatter.feature +4 -4
  151. data/features/docs/formatters/junit_formatter.feature +7 -6
  152. data/features/docs/formatters/pretty_formatter.feature +1 -0
  153. data/features/docs/formatters/progress_formatter.feature +1 -0
  154. data/features/docs/formatters/rerun_formatter.feature +2 -0
  155. data/features/docs/formatters/summary_formatter.feature +35 -0
  156. data/features/docs/formatters/usage_formatter.feature +3 -0
  157. data/features/docs/getting_started.feature +2 -1
  158. data/features/docs/gherkin/background.feature +5 -5
  159. data/features/docs/gherkin/doc_strings.feature +2 -0
  160. data/features/docs/gherkin/expand_option_for_outlines.feature +1 -0
  161. data/features/docs/gherkin/outlines.feature +6 -4
  162. data/features/docs/gherkin/unicode_table.feature +2 -1
  163. data/features/docs/gherkin/using_descriptions.feature +1 -0
  164. data/features/docs/gherkin/using_star_notation.feature +1 -1
  165. data/features/docs/post_configuration_hook.feature +1 -17
  166. data/features/docs/rake_task.feature +5 -0
  167. data/features/docs/raketask.feature +3 -1
  168. data/features/docs/work_in_progress.feature +5 -2
  169. data/features/docs/writing_support_code/after_step_hooks.feature +3 -1
  170. data/features/docs/writing_support_code/around_hooks.feature +6 -0
  171. data/features/docs/writing_support_code/before_hook.feature +1 -0
  172. data/features/docs/writing_support_code/hook_order.feature +3 -1
  173. data/features/docs/writing_support_code/parameter_types.feature +53 -0
  174. data/features/docs/writing_support_code/tagged_hooks.feature +1 -1
  175. data/features/docs/writing_support_code/world.feature +129 -0
  176. data/features/lib/step_definitions/aruba_steps.rb +5 -10
  177. data/features/lib/step_definitions/cli_steps.rb +4 -0
  178. data/features/lib/step_definitions/cucumber_steps.rb +9 -12
  179. data/features/lib/step_definitions/iso-8859-1_steps.rb +9 -5
  180. data/features/lib/step_definitions/json_steps.rb +2 -1
  181. data/features/lib/step_definitions/junit_steps.rb +2 -1
  182. data/features/lib/step_definitions/language_steps.rb +3 -2
  183. data/features/lib/step_definitions/profile_steps.rb +7 -6
  184. data/features/lib/step_definitions/retry_steps.rb +33 -13
  185. data/features/lib/step_definitions/ruby_steps.rb +2 -1
  186. data/features/lib/support/env.rb +3 -2
  187. data/features/lib/support/fake_wire_server.rb +17 -3
  188. data/features/lib/support/feature_factory.rb +2 -1
  189. data/features/lib/support/normalise_output.rb +14 -12
  190. data/features/lib/support/parameter_types.rb +5 -0
  191. data/gem_tasks/contributors.rake +10 -6
  192. data/gem_tasks/cov.rake +1 -0
  193. data/gem_tasks/downloads.rb +1 -0
  194. data/gem_tasks/environment.rake +2 -5
  195. data/gem_tasks/examples.rake +3 -2
  196. data/gem_tasks/fix_cr_lf.rake +19 -7
  197. data/gem_tasks/flog.rake +4 -3
  198. data/gem_tasks/rspec.rake +2 -1
  199. data/gem_tasks/sass.rake +2 -1
  200. data/lib/autotest/cucumber.rb +1 -0
  201. data/lib/autotest/cucumber_mixin.rb +17 -16
  202. data/lib/autotest/cucumber_rails.rb +1 -0
  203. data/lib/autotest/cucumber_rails_rspec.rb +1 -0
  204. data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
  205. data/lib/autotest/cucumber_rspec.rb +1 -0
  206. data/lib/autotest/cucumber_rspec2.rb +1 -0
  207. data/lib/autotest/discover.rb +3 -2
  208. data/lib/cucumber/cli/configuration.rb +12 -21
  209. data/lib/cucumber/cli/main.rb +8 -7
  210. data/lib/cucumber/cli/options.rb +341 -217
  211. data/lib/cucumber/cli/profile_loader.rb +26 -21
  212. data/lib/cucumber/cli/rerun_file.rb +1 -0
  213. data/lib/cucumber/configuration.rb +54 -37
  214. data/lib/cucumber/constantize.rb +2 -1
  215. data/lib/cucumber/core_ext/string.rb +2 -1
  216. data/lib/cucumber/deprecate.rb +4 -3
  217. data/lib/cucumber/encoding.rb +1 -0
  218. data/lib/cucumber/errors.rb +3 -1
  219. data/lib/cucumber/events/gherkin_source_read.rb +17 -0
  220. data/lib/cucumber/events/{step_match.rb → step_activated.rb} +5 -2
  221. data/lib/cucumber/events/step_definition_registered.rb +24 -0
  222. data/lib/cucumber/events/test_case_finished.rb +18 -0
  223. data/lib/cucumber/events/test_case_started.rb +15 -0
  224. data/lib/cucumber/events/test_run_finished.rb +12 -0
  225. data/lib/cucumber/events/test_run_started.rb +16 -0
  226. data/lib/cucumber/events/test_step_finished.rb +20 -0
  227. data/lib/cucumber/events/test_step_started.rb +17 -0
  228. data/lib/cucumber/events.rb +23 -3
  229. data/lib/cucumber/file_specs.rb +1 -0
  230. data/lib/cucumber/filters/activate_steps.rb +8 -3
  231. data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
  232. data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
  233. data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
  234. data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
  235. data/lib/cucumber/filters/broadcast_test_run_started_event.rb +27 -0
  236. data/lib/cucumber/filters/gated_receiver.rb +1 -0
  237. data/lib/cucumber/filters/prepare_world.rb +1 -0
  238. data/lib/cucumber/filters/quit.rb +1 -0
  239. data/lib/cucumber/filters/randomizer.rb +1 -0
  240. data/lib/cucumber/filters/retry.rb +4 -4
  241. data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -0
  242. data/lib/cucumber/filters/tag_limits/verifier.rb +2 -1
  243. data/lib/cucumber/filters/tag_limits.rb +4 -3
  244. data/lib/cucumber/filters.rb +3 -0
  245. data/lib/cucumber/formatter/ansicolor.rb +9 -11
  246. data/lib/cucumber/formatter/backtrace_filter.rb +21 -8
  247. data/lib/cucumber/formatter/console.rb +72 -66
  248. data/lib/cucumber/formatter/console_counts.rb +44 -0
  249. data/lib/cucumber/formatter/console_issues.rb +58 -0
  250. data/lib/cucumber/formatter/duration.rb +2 -1
  251. data/lib/cucumber/formatter/duration_extractor.rb +1 -0
  252. data/lib/cucumber/formatter/fail_fast.rb +4 -2
  253. data/lib/cucumber/formatter/fanout.rb +1 -0
  254. data/lib/cucumber/formatter/hook_query_visitor.rb +1 -0
  255. data/lib/cucumber/formatter/html.rb +175 -249
  256. data/lib/cucumber/formatter/html_builder.rb +120 -0
  257. data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -0
  258. data/lib/cucumber/formatter/inline-js.js +30 -0
  259. data/lib/cucumber/formatter/interceptor.rb +3 -2
  260. data/lib/cucumber/formatter/io.rb +2 -1
  261. data/lib/cucumber/formatter/json.rb +33 -30
  262. data/lib/cucumber/formatter/json_pretty.rb +1 -0
  263. data/lib/cucumber/formatter/junit.rb +26 -24
  264. data/lib/cucumber/formatter/legacy_api/adapter.rb +81 -69
  265. data/lib/cucumber/formatter/legacy_api/ast.rb +27 -22
  266. data/lib/cucumber/formatter/legacy_api/results.rb +7 -8
  267. data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +1 -0
  268. data/lib/cucumber/formatter/pretty.rb +24 -18
  269. data/lib/cucumber/formatter/progress.rb +55 -13
  270. data/lib/cucumber/formatter/rerun.rb +15 -18
  271. data/lib/cucumber/formatter/stepdefs.rb +1 -0
  272. data/lib/cucumber/formatter/steps.rb +2 -1
  273. data/lib/cucumber/formatter/summary.rb +43 -20
  274. data/lib/cucumber/formatter/unicode.rb +2 -1
  275. data/lib/cucumber/formatter/usage.rb +33 -28
  276. data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
  277. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +2 -1
  278. data/lib/cucumber/gherkin/formatter/escaping.rb +2 -1
  279. data/lib/cucumber/gherkin/i18n.rb +1 -0
  280. data/lib/cucumber/gherkin/steps_parser.rb +1 -0
  281. data/lib/cucumber/{rb_support/rb_dsl.rb → glue/dsl.rb} +41 -30
  282. data/lib/cucumber/glue/hook.rb +43 -0
  283. data/lib/cucumber/glue/invoke_in_world.rb +70 -0
  284. data/lib/cucumber/glue/proto_world.rb +220 -0
  285. data/lib/cucumber/{rb_support/rb_language.rb → glue/registry_and_more.rb} +60 -90
  286. data/lib/cucumber/{rb_support → glue}/snippet.rb +64 -26
  287. data/lib/cucumber/glue/step_definition.rb +143 -0
  288. data/lib/cucumber/glue/world_factory.rb +23 -0
  289. data/lib/cucumber/hooks.rb +9 -8
  290. data/lib/cucumber/load_path.rb +1 -0
  291. data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +158 -0
  292. data/lib/cucumber/multiline_argument/data_table.rb +47 -181
  293. data/lib/cucumber/multiline_argument/doc_string.rb +1 -0
  294. data/lib/cucumber/multiline_argument.rb +6 -15
  295. data/lib/cucumber/platform.rb +4 -5
  296. data/lib/cucumber/project_initializer.rb +3 -2
  297. data/lib/cucumber/rake/task.rb +19 -14
  298. data/lib/cucumber/rspec/disable_option_parser.rb +2 -1
  299. data/lib/cucumber/rspec/doubles.rb +2 -1
  300. data/lib/cucumber/running_test_case.rb +3 -27
  301. data/lib/cucumber/runtime/after_hooks.rb +2 -1
  302. data/lib/cucumber/runtime/before_hooks.rb +1 -0
  303. data/lib/cucumber/runtime/for_programming_languages.rb +2 -36
  304. data/lib/cucumber/runtime/step_hooks.rb +1 -0
  305. data/lib/cucumber/runtime/support_code.rb +21 -16
  306. data/lib/cucumber/runtime/user_interface.rb +10 -16
  307. data/lib/cucumber/runtime.rb +49 -32
  308. data/lib/cucumber/step_argument.rb +1 -2
  309. data/lib/cucumber/step_definition_light.rb +2 -0
  310. data/lib/cucumber/step_definitions.rb +1 -0
  311. data/lib/cucumber/step_match.rb +30 -15
  312. data/lib/cucumber/step_match_search.rb +3 -3
  313. data/lib/cucumber/term/ansicolor.rb +2 -1
  314. data/lib/cucumber/unit.rb +1 -0
  315. data/lib/cucumber/version +1 -1
  316. data/lib/cucumber.rb +1 -13
  317. data/lib/simplecov_setup.rb +2 -1
  318. data/scripts/invite-collaborator +40 -0
  319. data/scripts/update-changelog +86 -0
  320. data/spec/cucumber/cli/configuration_spec.rb +109 -98
  321. data/spec/cucumber/cli/main_spec.rb +8 -7
  322. data/spec/cucumber/cli/options_spec.rb +114 -79
  323. data/spec/cucumber/cli/profile_loader_spec.rb +25 -5
  324. data/spec/cucumber/cli/rerun_spec.rb +21 -20
  325. data/spec/cucumber/configuration_spec.rb +48 -47
  326. data/spec/cucumber/constantize_spec.rb +3 -2
  327. data/spec/cucumber/events_spec.rb +9 -0
  328. data/spec/cucumber/file_specs_spec.rb +26 -25
  329. data/spec/cucumber/filters/activate_steps_spec.rb +25 -22
  330. data/spec/cucumber/filters/gated_receiver_spec.rb +7 -6
  331. data/spec/cucumber/filters/retry_spec.rb +42 -23
  332. data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +12 -11
  333. data/spec/cucumber/filters/tag_limits/verifier_spec.rb +15 -14
  334. data/spec/cucumber/filters/tag_limits_spec.rb +9 -8
  335. data/spec/cucumber/formatter/ansicolor_spec.rb +10 -9
  336. data/spec/cucumber/formatter/backtrace_filter_spec.rb +32 -0
  337. data/spec/cucumber/formatter/console_counts_spec.rb +14 -0
  338. data/spec/cucumber/formatter/duration_spec.rb +4 -3
  339. data/spec/cucumber/formatter/fail_fast_spec.rb +27 -27
  340. data/spec/cucumber/formatter/html_spec.rb +65 -60
  341. data/spec/cucumber/formatter/interceptor_spec.rb +1 -0
  342. data/spec/cucumber/formatter/json_spec.rb +71 -97
  343. data/spec/cucumber/formatter/junit_spec.rb +46 -47
  344. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +134 -141
  345. data/spec/cucumber/formatter/pretty_spec.rb +105 -117
  346. data/spec/cucumber/formatter/progress_spec.rb +22 -21
  347. data/spec/cucumber/formatter/rerun_spec.rb +70 -64
  348. data/spec/cucumber/formatter/spec_helper.rb +14 -12
  349. data/spec/cucumber/{rb_support/rb_world_spec.rb → glue/proto_world_spec.rb} +22 -6
  350. data/spec/cucumber/glue/registry_and_more_spec.rb +213 -0
  351. data/spec/cucumber/{rb_support → glue}/snippet_spec.rb +62 -25
  352. data/spec/cucumber/glue/step_definition_spec.rb +207 -0
  353. data/spec/cucumber/hooks_spec.rb +5 -4
  354. data/spec/cucumber/multiline_argument/data_table_spec.rb +179 -129
  355. data/spec/cucumber/project_initializer_spec.rb +12 -11
  356. data/spec/cucumber/rake/forked_spec.rb +22 -17
  357. data/spec/cucumber/rake/task_spec.rb +21 -20
  358. data/spec/cucumber/running_test_case_spec.rb +36 -35
  359. data/spec/cucumber/runtime/for_programming_languages_spec.rb +2 -30
  360. data/spec/cucumber/runtime/support_code_spec.rb +1 -0
  361. data/spec/cucumber/runtime_spec.rb +3 -2
  362. data/spec/cucumber/step_argument_spec.rb +6 -5
  363. data/spec/cucumber/step_match_search_spec.rb +32 -41
  364. data/spec/cucumber/step_match_spec.rb +34 -33
  365. data/spec/cucumber/world/pending_spec.rb +12 -11
  366. data/spec/spec_helper.rb +1 -0
  367. data/spec/support/standard_step_actions.rb +2 -1
  368. metadata +132 -61
  369. data/features/docs/formatters/debug_formatter.feature +0 -47
  370. data/features/docs/formatters/formatter_step_file_colon_line.feature +0 -44
  371. data/features/docs/writing_support_code/transforms.feature +0 -98
  372. data/features/lib/step_definitions/wire_steps.rb +0 -58
  373. data/gem_tasks/cucumber.rake +0 -25
  374. data/lib/cucumber/ast.rb +0 -13
  375. data/lib/cucumber/core_ext/instance_exec.rb +0 -70
  376. data/lib/cucumber/events/after_test_case.rb +0 -25
  377. data/lib/cucumber/events/after_test_step.rb +0 -30
  378. data/lib/cucumber/events/before_test_case.rb +0 -18
  379. data/lib/cucumber/events/before_test_step.rb +0 -23
  380. data/lib/cucumber/events/bus.rb +0 -86
  381. data/lib/cucumber/events/finished_testing.rb +0 -9
  382. data/lib/cucumber/formatter/debug.rb +0 -35
  383. data/lib/cucumber/formatter/event_bus_report.rb +0 -38
  384. data/lib/cucumber/rb_support/rb_hook.rb +0 -19
  385. data/lib/cucumber/rb_support/rb_step_definition.rb +0 -131
  386. data/lib/cucumber/rb_support/rb_transform.rb +0 -59
  387. data/lib/cucumber/rb_support/rb_world.rb +0 -149
  388. data/spec/cucumber/core_ext/instance_exec_spec.rb +0 -4
  389. data/spec/cucumber/events/bus_spec.rb +0 -94
  390. data/spec/cucumber/formatter/debug_spec.rb +0 -64
  391. data/spec/cucumber/formatter/event_bus_report_spec.rb +0 -88
  392. data/spec/cucumber/rb_support/rb_language_spec.rb +0 -243
  393. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +0 -199
  394. data/spec/cucumber/rb_support/rb_transform_spec.rb +0 -46
  395. data/spec/cucumber_spec.rb +0 -39
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env ruby
2
+ require 'octokit'
3
+
4
+ class PullRequest
5
+ attr_reader :gh, :num
6
+
7
+ def initialize(gh, num)
8
+ @gh = gh
9
+ @num = num
10
+ end
11
+
12
+ def entry
13
+ pr = gh.pull_request('cucumber/cucumber-ruby', num)
14
+ username = pr['user']['login']
15
+ url = pr['html_url']
16
+ title = pr['title']
17
+ "#{title} ([##{num}](#{url}) [@#{username}](https://github.com/#{username}))"
18
+ end
19
+
20
+ def labels
21
+ gh.labels_for_issue('cucumber/cucumber-ruby', num).map { |label| label['name'] }
22
+ end
23
+
24
+ def type_label
25
+ types = labels.select { |label| label =~ /^type: / }
26
+ if types.empty?
27
+ raise('This pull request does not have a \'type\' label on it. Please add one.')
28
+ end
29
+
30
+ if types.length > 1
31
+ raise('This pull request has more than one \'type\' label on it. Please choose just one.')
32
+ end
33
+
34
+ types.first
35
+ end
36
+ end
37
+
38
+ class Changelog
39
+ def self.open(path, &block)
40
+ full_path = File.expand_path(File.dirname(__FILE__) + '/' + path + '/CHANGELOG.md')
41
+ log = new(File.read(full_path))
42
+ log.instance_exec(&block)
43
+ File.write(full_path, log.body)
44
+ end
45
+
46
+ attr_reader :lines
47
+
48
+ def initialize(body)
49
+ @lines = body.lines
50
+ end
51
+
52
+ def insert(label, entry)
53
+ section_index = lines.index { |line| line.strip == heading_for(label) }
54
+ unless section_index
55
+ raise("Unable to find matching heading in CHANGELOG.md for '#{label}' (#{heading_for(label)})")
56
+ end
57
+ lines.insert(section_index + 2, "* #{entry}\n")
58
+ end
59
+
60
+ def heading_for(label)
61
+ text = {
62
+ 'type: new feature' => 'Added',
63
+ 'type: bug' => 'Fixed',
64
+ 'type: refactoring / developer experience' => 'Changed'
65
+ }.fetch(label)
66
+ "### #{text}"
67
+ end
68
+
69
+ def body
70
+ lines.join
71
+ end
72
+ end
73
+
74
+ begin
75
+ token = ENV['GITHUB_TOKEN'] || raise('You need to set GITHUB_TOKEN')
76
+ num = (ARGV[0] || raise("syntax: #{$0} <PULL-REQUEST-NUMBER>")).to_i
77
+
78
+ gh = Octokit::Client.new(access_token: token)
79
+ pr = PullRequest.new(gh, num)
80
+
81
+ Changelog.open('..') do
82
+ insert(pr.type_label, pr.entry)
83
+ end
84
+ rescue StandardError => error
85
+ abort error.message
86
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'yaml'
3
4
 
@@ -37,7 +38,7 @@ module Cli
37
38
 
38
39
  attr_reader :out, :error
39
40
 
40
- it "uses the default profile when no profile is defined" do
41
+ it 'uses the default profile when no profile is defined' do
41
42
  given_cucumber_yml_defined_as({'default' => '--require some_file'})
42
43
 
43
44
  config.parse!(%w{--format progress})
@@ -48,16 +49,16 @@ module Cli
48
49
  context '--profile' do
49
50
  include RSpec::WorkInProgress
50
51
 
51
- it "expands args from profiles in the cucumber.yml file" do
52
+ it 'expands args from profiles in the cucumber.yml file' do
52
53
  given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
53
54
 
54
55
  config.parse!(%w{--format progress --profile bongo})
55
56
 
56
- expect(config.options[:formats]).to eq [['progress', out]]
57
+ expect(config.options[:formats]).to eq [['progress', {}, out]]
57
58
  expect(config.options[:require]).to eq ['from/yml']
58
59
  end
59
60
 
60
- it "expands args from the default profile when no flags are provided" do
61
+ it 'expands args from the default profile when no flags are provided' do
61
62
  given_cucumber_yml_defined_as({'default' => '--require from/yml'})
62
63
 
63
64
  config.parse!([])
@@ -65,15 +66,27 @@ module Cli
65
66
  expect(config.options[:require]).to eq ['from/yml']
66
67
  end
67
68
 
68
- it "allows --strict to be set by a profile" do
69
+ it 'allows --strict to be set by a profile' do
69
70
  given_cucumber_yml_defined_as({'bongo' => '--strict'})
70
71
 
71
72
  config.parse!(%w{--profile bongo})
72
73
 
73
- expect(config.options[:strict]).to be true
74
+ expect(config.options[:strict].strict?(:undefined)).to be true
75
+ expect(config.options[:strict].strict?(:pending)).to be true
76
+ expect(config.options[:strict].strict?(:flaky)).to be true
74
77
  end
75
78
 
76
- it "parses ERB syntax in the cucumber.yml file" do
79
+ it 'allows --strict from a profile to be selectively overridden' do
80
+ given_cucumber_yml_defined_as({'bongo' => '--strict'})
81
+
82
+ config.parse!(%w{--profile bongo --no-strict-flaky})
83
+
84
+ expect(config.options[:strict].strict?(:undefined)).to be true
85
+ expect(config.options[:strict].strict?(:pending)).to be true
86
+ expect(config.options[:strict].strict?(:flaky)).to be false
87
+ end
88
+
89
+ it 'parses ERB syntax in the cucumber.yml file' do
77
90
  given_cucumber_yml_defined_as("---\ndefault: \"<%=\"--require some_file\"%>\"\n")
78
91
 
79
92
  config.parse!([])
@@ -81,7 +94,7 @@ module Cli
81
94
  expect(config.options[:require]).to include('some_file')
82
95
  end
83
96
 
84
- it "parses ERB in cucumber.yml that makes uses nested ERB sessions" do
97
+ it 'parses ERB in cucumber.yml that makes uses nested ERB sessions' do
85
98
  given_cucumber_yml_defined_as(<<ERB_YML)
86
99
  <%= ERB.new({'standard' => '--require some_file'}.to_yaml).result %>
87
100
  <%= ERB.new({'enhanced' => '--require other_file'}.to_yaml).result %>
@@ -92,7 +105,7 @@ ERB_YML
92
105
  expect(config.options[:require]).to include('some_file')
93
106
  end
94
107
 
95
- it "provides a helpful error message when a specified profile does not exists in cucumber.yml" do
108
+ it 'provides a helpful error message when a specified profile does not exists in cucumber.yml' do
96
109
  given_cucumber_yml_defined_as({'default' => '--require from/yml', 'html_report' => '--format html'})
97
110
 
98
111
  expected_message = <<-END_OF_MESSAGE
@@ -106,42 +119,42 @@ END_OF_MESSAGE
106
119
  expect(-> { config.parse!(%w{--profile i_do_not_exist}) }).to raise_error(ProfileNotFound, expected_message)
107
120
  end
108
121
 
109
- it "allows profiles to be defined in arrays" do
122
+ it 'allows profiles to be defined in arrays' do
110
123
  given_cucumber_yml_defined_as({'foo' => ['-f','progress']})
111
124
 
112
125
  config.parse!(%w{--profile foo})
113
126
 
114
- expect(config.options[:formats]).to eq [['progress', out]]
127
+ expect(config.options[:formats]).to eq [['progress', {}, out]]
115
128
  end
116
129
 
117
- it "disregards default STDOUT formatter defined in profile when another is passed in (via cmd line)" do
130
+ it 'disregards default STDOUT formatter defined in profile when another is passed in (via cmd line)' do
118
131
  given_cucumber_yml_defined_as({'foo' => %w[--format pretty]})
119
132
  config.parse!(%w{--format progress --profile foo})
120
133
 
121
- expect(config.options[:formats]).to eq [['progress', out]]
134
+ expect(config.options[:formats]).to eq [['progress', {}, out]]
122
135
  end
123
136
 
124
- ["--no-profile", "-P"].each do |flag|
137
+ ['--no-profile', '-P'].each do |flag|
125
138
  context 'when none is specified with #{flag}' do
126
- it "disables profiles" do
139
+ it 'disables profiles' do
127
140
  given_cucumber_yml_defined_as({'default' => '-v --require file_specified_in_default_profile.rb'})
128
141
 
129
- config.parse!("#{flag} --require some_file.rb".split(" "))
142
+ config.parse!("#{flag} --require some_file.rb".split(' '))
130
143
 
131
144
  expect(config.options[:require]).to eq ['some_file.rb']
132
145
  end
133
146
 
134
- it "notifies the user that the profiles are being disabled" do
147
+ it 'notifies the user that the profiles are being disabled' do
135
148
  given_cucumber_yml_defined_as({'default' => '-v'})
136
149
 
137
- config.parse!("#{flag} --require some_file.rb".split(" "))
150
+ config.parse!("#{flag} --require some_file.rb".split(' '))
138
151
 
139
- expect(out.string).to match /Disabling profiles.../
152
+ expect(out.string).to match(/Disabling profiles.../)
140
153
  end
141
154
  end
142
155
  end
143
156
 
144
- it "issues a helpful error message when a specified profile exists but is nil or blank" do
157
+ it 'issues a helpful error message when a specified profile exists but is nil or blank' do
145
158
  [nil, ' '].each do |bad_input|
146
159
  given_cucumber_yml_defined_as({'foo' => bad_input})
147
160
 
@@ -151,7 +164,7 @@ END_OF_MESSAGE
151
164
  end
152
165
  end
153
166
 
154
- it "issues a helpful error message when no YAML file exists and a profile is specified" do
167
+ it 'issues a helpful error message when no YAML file exists and a profile is specified' do
155
168
  expect(File).to receive(:exist?).with('cucumber.yml') { false }
156
169
 
157
170
  expected_error = /cucumber\.yml was not found/
@@ -159,10 +172,10 @@ END_OF_MESSAGE
159
172
  expect(-> { config.parse!(%w{--profile i_do_not_exist}) }).to raise_error(expected_error)
160
173
  end
161
174
 
162
- it "issues a helpful error message when cucumber.yml is blank or malformed" do
175
+ it 'issues a helpful error message when cucumber.yml is blank or malformed' do
163
176
  expected_error_message = /cucumber\.yml was found, but was blank or malformed. Please refer to cucumber's documentation on correct profile usage./
164
177
 
165
- ['', 'sfsadfs', "--- \n- an\n- array\n", "---dddfd"].each do |bad_input|
178
+ ['', 'sfsadfs', "--- \n- an\n- array\n", '---dddfd'].each do |bad_input|
166
179
  given_cucumber_yml_defined_as(bad_input)
167
180
 
168
181
  expect(-> { config.parse!([]) }).to raise_error(expected_error_message)
@@ -171,149 +184,149 @@ END_OF_MESSAGE
171
184
  end
172
185
  end
173
186
 
174
- it "issues a helpful error message when cucumber.yml can not be parsed" do
187
+ it 'issues a helpful error message when cucumber.yml can not be parsed' do
175
188
  expected_error_message = /cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage./
176
189
 
177
- given_cucumber_yml_defined_as("input that causes an exception in YAML loading")
190
+ given_cucumber_yml_defined_as('input that causes an exception in YAML loading')
178
191
 
179
192
  expect(YAML).to receive(:load).and_raise(ArgumentError)
180
193
  expect(-> { config.parse!([]) }).to raise_error(expected_error_message)
181
194
  end
182
195
 
183
- it "issues a helpful error message when cucumber.yml can not be parsed by ERB" do
196
+ it 'issues a helpful error message when cucumber.yml can not be parsed by ERB' do
184
197
  expected_error_message = /cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage./
185
- given_cucumber_yml_defined_as("<% this_fails %>")
198
+ given_cucumber_yml_defined_as('<% this_fails %>')
186
199
 
187
200
  expect(-> { config.parse!([]) }).to raise_error(expected_error_message)
188
201
  end
189
202
  end
190
203
 
191
- it "accepts --dry-run option" do
204
+ it 'accepts --dry-run option' do
192
205
  config.parse!(%w{--dry-run})
193
206
 
194
207
  expect(config.options[:dry_run]).to be true
195
208
  end
196
-
197
- it "implies --no-duration with --dry-run option" do
209
+
210
+ it 'implies --no-duration with --dry-run option' do
198
211
  config.parse!(%w{--dry-run})
199
-
212
+
200
213
  expect(config.options[:duration]).to be false
201
214
  end
202
215
 
203
- it "accepts --no-source option" do
216
+ it 'accepts --no-source option' do
204
217
  config.parse!(%w{--no-source})
205
218
 
206
219
  expect(config.options[:source]).to be false
207
220
  end
208
221
 
209
- it "accepts --no-snippets option" do
222
+ it 'accepts --no-snippets option' do
210
223
  config.parse!(%w{--no-snippets})
211
224
 
212
225
  expect(config.options[:snippets]).to be false
213
226
  end
214
227
 
215
- it "sets snippets and source and duration to false with --quiet option" do
228
+ it 'sets snippets and source and duration to false with --quiet option' do
216
229
  config.parse!(%w{--quiet})
217
230
 
218
231
  expect(config.options[:snippets]).to be false
219
232
  expect(config.options[:source]).to be false
220
233
  expect(config.options[:duration]).to be false
221
234
  end
222
-
223
- it "sets duration to false with --no-duration" do
235
+
236
+ it 'sets duration to false with --no-duration' do
224
237
  config.parse!(%w{--no-duration})
225
-
238
+
226
239
  expect(config.options[:duration]).to be false
227
240
  end
228
241
 
229
- it "accepts --verbose option" do
242
+ it 'accepts --verbose option' do
230
243
  config.parse!(%w{--verbose})
231
244
 
232
245
  expect(config.options[:verbose]).to be true
233
246
  end
234
247
 
235
- it "accepts --out option" do
248
+ it 'accepts --out option' do
236
249
  config.parse!(%w{--out jalla.txt})
237
250
 
238
- expect(config.formats).to eq [['pretty', 'jalla.txt']]
251
+ expect(config.formats).to eq [['pretty', {}, 'jalla.txt']]
239
252
  end
240
253
 
241
- it "accepts multiple --out options" do
254
+ it 'accepts multiple --out options' do
242
255
  config.parse!(%w{--format progress --out file1 --out file2})
243
256
 
244
- expect(config.formats).to eq [['progress', 'file2']]
257
+ expect(config.formats).to eq [['progress', {}, 'file2']]
245
258
  end
246
259
 
247
- it "accepts multiple --format options and put the STDOUT one first so progress is seen" do
260
+ it 'accepts multiple --format options and put the STDOUT one first so progress is seen' do
248
261
  config.parse!(%w{--format pretty --out pretty.txt --format progress})
249
262
 
250
- expect(config.formats).to eq [['progress', out], ['pretty', 'pretty.txt']]
263
+ expect(config.formats).to eq [['progress', {}, out], ['pretty', {}, 'pretty.txt']]
251
264
  end
252
265
 
253
- it "does not accept multiple --format options when both use implicit STDOUT" do
254
- expect(-> { config.parse!(%w{--format pretty --format progress}) }).to raise_error("All but one formatter must use --out, only one can print to each stream (or STDOUT)")
266
+ it 'does not accept multiple --format options when both use implicit STDOUT' do
267
+ expect(-> { config.parse!(%w{--format pretty --format progress}) }).to raise_error('All but one formatter must use --out, only one can print to each stream (or STDOUT)')
255
268
  end
256
269
 
257
- it "does not accept multiple --format options when both use implicit STDOUT (using profile with no formatters)" do
270
+ it 'does not accept multiple --format options when both use implicit STDOUT (using profile with no formatters)' do
258
271
  given_cucumber_yml_defined_as({'default' => ['-q']})
259
- expect(-> { config.parse!(%w{--format pretty --format progress}) }).to raise_error("All but one formatter must use --out, only one can print to each stream (or STDOUT)")
272
+ expect(-> { config.parse!(%w{--format pretty --format progress}) }).to raise_error('All but one formatter must use --out, only one can print to each stream (or STDOUT)')
260
273
  end
261
274
 
262
- it "accepts same --format options with implicit STDOUT, and keep only one" do
275
+ it 'accepts same --format options with implicit STDOUT, and keep only one' do
263
276
  config.parse!(%w{--format pretty --format pretty})
264
277
 
265
- expect(config.formats).to eq [["pretty", out]]
278
+ expect(config.formats).to eq [['pretty', {}, out]]
266
279
  end
267
280
 
268
- it "does not accept multiple --out streams pointing to the same place" do
269
- expect(-> { config.parse!(%w{--format pretty --out file1 --format progress --out file1}) }).to raise_error("All but one formatter must use --out, only one can print to each stream (or STDOUT)")
281
+ it 'does not accept multiple --out streams pointing to the same place' do
282
+ expect(-> { config.parse!(%w{--format pretty --out file1 --format progress --out file1}) }).to raise_error('All but one formatter must use --out, only one can print to each stream (or STDOUT)')
270
283
  end
271
284
 
272
- it "does not accept multiple --out streams pointing to the same place (one from profile, one from command line)" do
285
+ it 'does not accept multiple --out streams pointing to the same place (one from profile, one from command line)' do
273
286
  given_cucumber_yml_defined_as({'default' => ['-f','progress', '--out', 'file1']})
274
- expect(-> { config.parse!(%w{--format pretty --out file1}) }).to raise_error("All but one formatter must use --out, only one can print to each stream (or STDOUT)")
287
+ expect(-> { config.parse!(%w{--format pretty --out file1}) }).to raise_error('All but one formatter must use --out, only one can print to each stream (or STDOUT)')
275
288
  end
276
289
 
277
- it "associates --out to previous --format" do
290
+ it 'associates --out to previous --format' do
278
291
  config.parse!(%w{--format progress --out file1 --format profile --out file2})
279
292
 
280
- expect(config.formats).to eq [["progress", "file1"], ["profile" ,"file2"]]
293
+ expect(config.formats).to eq [['progress', {}, 'file1'], ['profile', {}, 'file2']]
281
294
  end
282
295
 
283
- it "accepts same --format options with same --out streams and keep only one" do
296
+ it 'accepts same --format options with same --out streams and keep only one' do
284
297
  config.parse!(%w{--format html --out file --format pretty --format html --out file})
285
298
 
286
- expect(config.formats).to eq [["pretty", out], ["html", "file"]]
299
+ expect(config.formats).to eq [['pretty', {}, out], ['html', {}, 'file']]
287
300
  end
288
301
 
289
- it "accepts same --format options with different --out streams" do
302
+ it 'accepts same --format options with different --out streams' do
290
303
  config.parse!(%w{--format html --out file1 --format html --out file2})
291
304
 
292
- expect(config.formats).to eq [["html", "file1"], ["html", "file2"]]
305
+ expect(config.formats).to eq [['html', {}, 'file1'], ['html', {}, 'file2']]
293
306
  end
294
307
 
295
- it "accepts --color option" do
308
+ it 'accepts --color option' do
296
309
  expect(Cucumber::Term::ANSIColor).to receive(:coloring=).with(true)
297
310
 
298
311
  config.parse!(['--color'])
299
312
  end
300
313
 
301
- it "accepts --no-color option" do
314
+ it 'accepts --no-color option' do
302
315
  expect(Cucumber::Term::ANSIColor).to receive(:coloring=).with(false)
303
316
 
304
317
  config = Configuration.new(StringIO.new)
305
318
  config.parse!(['--no-color'])
306
319
  end
307
320
 
308
- describe "--backtrace" do
321
+ describe '--backtrace' do
309
322
  before do
310
323
  Cucumber.use_full_backtrace = false
311
324
  end
312
325
 
313
- it "shows full backtrace when --backtrace is present" do
326
+ it 'shows full backtrace when --backtrace is present' do
314
327
  Main.new(['--backtrace'])
315
328
  begin
316
- expect("x").to eq "y"
329
+ expect('x').to eq 'y'
317
330
  rescue RSpec::Expectations::ExpectationNotMetError => e
318
331
  expect(e.backtrace[0]).not_to eq "#{__FILE__}:#{__LINE__ - 2}"
319
332
  end
@@ -324,108 +337,106 @@ END_OF_MESSAGE
324
337
  end
325
338
  end
326
339
 
327
- it "accepts multiple --name options" do
328
- config.parse!(['--name', "User logs in", '--name', "User signs up"])
340
+ it 'accepts multiple --name options' do
341
+ config.parse!(['--name', 'User logs in', '--name', 'User signs up'])
329
342
 
330
343
  expect(config.options[:name_regexps]).to include(/User logs in/)
331
344
  expect(config.options[:name_regexps]).to include(/User signs up/)
332
345
  end
333
346
 
334
- it "accepts multiple -n options" do
335
- config.parse!(['-n', "User logs in", '-n', "User signs up"])
347
+ it 'accepts multiple -n options' do
348
+ config.parse!(['-n', 'User logs in', '-n', 'User signs up'])
336
349
 
337
350
  expect(config.options[:name_regexps]).to include(/User logs in/)
338
351
  expect(config.options[:name_regexps]).to include(/User signs up/)
339
352
  end
340
353
 
341
- it "should allow specifying environment variables on the command line" do
342
- config.parse!(["foo=bar"])
354
+ it 'should allow specifying environment variables on the command line' do
355
+ config.parse!(['foo=bar'])
343
356
 
344
- expect(ENV["foo"]).to eq "bar"
357
+ expect(ENV['foo']).to eq 'bar'
345
358
  expect(config.paths).not_to include('foo=bar')
346
359
  end
347
360
 
348
- it "allows specifying environment variables in profiles" do
361
+ it 'allows specifying environment variables in profiles' do
349
362
  given_cucumber_yml_defined_as({'selenium' => 'RAILS_ENV=selenium'})
350
- config.parse!(["--profile", "selenium"])
363
+ config.parse!(['--profile', 'selenium'])
351
364
 
352
- expect(ENV["RAILS_ENV"]).to eq "selenium"
365
+ expect(ENV['RAILS_ENV']).to eq 'selenium'
353
366
  expect(config.paths).not_to include('RAILS_ENV=selenium')
354
367
  end
355
368
 
356
- describe "#tag_expression" do
357
- include RSpec::WorkInProgress
358
-
359
- it "returns an empty expression when no tags are specified" do
369
+ describe '#tag_expressions' do
370
+ it 'returns an empty expression when no tags are specified' do
360
371
  config.parse!([])
361
372
 
362
- expect(config.tag_expression).to be_empty
373
+ expect(config.tag_expressions).to be_empty
363
374
  end
364
375
 
365
- it "returns an expression when tags are specified" do
376
+ it 'returns an expression when tags are specified' do
366
377
  config.parse!(['--tags','@foo'])
367
378
 
368
- expect(config.tag_expression).not_to be_empty
379
+ expect(config.tag_expressions).not_to be_empty
369
380
  end
370
381
  end
371
382
 
372
383
  describe '#tag_limits' do
373
- it "returns an empty hash when no limits are specified" do
384
+ it 'returns an empty hash when no limits are specified' do
374
385
  config.parse!([])
375
386
 
376
387
  expect(config.tag_limits).to eq({ })
377
388
  end
378
389
 
379
- it "returns a hash of limits when limits are specified" do
390
+ it 'returns a hash of limits when limits are specified' do
380
391
  config.parse!(['--tags','@foo:1'])
381
392
 
382
- expect(config.tag_limits).to eq({ "@foo" => 1 })
393
+ expect(config.tag_limits).to eq({ '@foo' => 1 })
383
394
  end
384
395
  end
385
396
 
386
- describe "#dry_run?" do
387
- it "returns true when --dry-run was specified on in the arguments" do
397
+ describe '#dry_run?' do
398
+ it 'returns true when --dry-run was specified on in the arguments' do
388
399
  config.parse!(['--dry-run'])
389
400
 
390
401
  expect(config.dry_run?).to be true
391
402
  end
392
403
 
393
- it "returns true when --dry-run was specified in yaml file" do
404
+ it 'returns true when --dry-run was specified in yaml file' do
394
405
  given_cucumber_yml_defined_as({'default' => '--dry-run'})
395
406
  config.parse!([])
396
407
 
397
408
  expect(config.dry_run?).to be true
398
409
  end
399
410
 
400
- it "returns false by default" do
411
+ it 'returns false by default' do
401
412
  config.parse!([])
402
413
 
403
414
  expect(config.dry_run?).to be false
404
415
  end
405
416
  end
406
417
 
407
- describe "#snippet_type" do
408
- it "returns the snippet type when it was set" do
409
- config.parse!(["--snippet-type", "classic"])
418
+ describe '#snippet_type' do
419
+ it 'returns the snippet type when it was set' do
420
+ config.parse!(['--snippet-type', 'classic'])
410
421
 
411
422
  expect(config.snippet_type).to eq :classic
412
423
  end
413
424
 
414
- it "returns the snippet type when it was set with shorthand option" do
415
- config.parse!(["-I", "classic"])
425
+ it 'returns the snippet type when it was set with shorthand option' do
426
+ config.parse!(['-I', 'classic'])
416
427
 
417
428
  expect(config.snippet_type).to eq :classic
418
429
  end
419
430
 
420
- it "returns the default snippet type if it was not set" do
431
+ it 'returns the default snippet type if it was not set' do
421
432
  config.parse!([])
422
433
 
423
- expect(config.snippet_type).to eq :regexp
434
+ expect(config.snippet_type).to eq :cucumber_expression
424
435
  end
425
436
  end
426
437
 
427
- describe "#retry_attempts" do
428
- it "returns the specified number of retries" do
438
+ describe '#retry_attempts' do
439
+ it 'returns the specified number of retries' do
429
440
  config.parse!(['--retry=3'])
430
441
  expect(config.retry_attempts).to eql 3
431
442
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
  require 'yaml'
3
4
 
@@ -16,15 +17,15 @@ module Cucumber
16
17
  let(:kernel) { double(:kernel) }
17
18
  subject { Main.new(args, stdin, stdout, stderr, kernel)}
18
19
 
19
- describe "#execute!" do
20
- context "passed an existing runtime" do
20
+ describe '#execute!' do
21
+ context 'passed an existing runtime' do
21
22
  let(:existing_runtime) { double('runtime').as_null_object }
22
23
 
23
24
  def do_execute
24
25
  subject.execute!(existing_runtime)
25
26
  end
26
27
 
27
- it "configures that runtime" do
28
+ it 'configures that runtime' do
28
29
  expected_configuration = double('Configuration').as_null_object
29
30
 
30
31
  allow(Configuration).to receive(:new) { expected_configuration }
@@ -34,7 +35,7 @@ module Cucumber
34
35
  do_execute
35
36
  end
36
37
 
37
- it "uses that runtime for running and reporting results" do
38
+ it 'uses that runtime for running and reporting results' do
38
39
  expected_results = double('results', :failure? => true)
39
40
 
40
41
  expect(existing_runtime).to receive(:run!)
@@ -45,12 +46,12 @@ module Cucumber
45
46
  end
46
47
  end
47
48
 
48
- context "interrupted with ctrl-c" do
49
+ context 'interrupted with ctrl-c' do
49
50
  after do
50
51
  Cucumber.wants_to_quit = false
51
52
  end
52
53
 
53
- it "exits with error code" do
54
+ it 'exits with error code' do
54
55
  results = double('results', :failure? => false)
55
56
 
56
57
  allow_any_instance_of(Runtime).to receive(:run!)
@@ -70,7 +71,7 @@ module Cucumber
70
71
  configuration = double('configuration')
71
72
 
72
73
  allow(Configuration).to receive(:new) { configuration }
73
- allow(configuration).to receive(:parse!).and_raise(exception_klass.new("error message"))
74
+ allow(configuration).to receive(:parse!).and_raise(exception_klass.new('error message'))
74
75
  allow(kernel).to receive(:exit).with(2)
75
76
 
76
77
  subject.execute!