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.
- checksums.yaml +4 -4
- data/.cucumberproignore +6 -0
- data/.gitattributes +32 -0
- data/.github/ISSUE_TEMPLATE.md +1 -1
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +991 -0
- data/.travis.yml +56 -10
- data/{History.md → CHANGELOG.md} +166 -32
- data/CONTRIBUTING.md +21 -1
- data/Gemfile +18 -5
- data/README.md +13 -4
- data/Rakefile +12 -2
- data/appveyor.yml +27 -0
- data/bin/cucumber +2 -1
- data/cucumber.gemspec +15 -10
- data/cucumber.yml +10 -11
- data/examples/i18n/Rakefile +1 -1
- data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +8 -3
- data/examples/i18n/ar/lib/calculator.rb +2 -2
- data/examples/i18n/bg/features/step_definitions/calculator_steps.rb +6 -6
- data/examples/i18n/bg/features/support/env.rb +6 -1
- data/examples/i18n/bg/lib/calculator.rb +2 -1
- data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/ca/lib/calculadora.rb +2 -2
- data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/cs/lib/calculator.rb +3 -3
- data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +10 -5
- data/examples/i18n/da/lib/lommeregner.rb +2 -2
- data/examples/i18n/de/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/de/lib/calculator.rb +2 -2
- data/examples/i18n/el/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/el/lib/calculator.rb +2 -2
- data/examples/i18n/en/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/en/lib/calculator.rb +2 -2
- data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +4 -4
- data/examples/i18n/en-lol/features/support/env.rb +6 -2
- data/examples/i18n/en-lol/lib/basket.rb +2 -2
- data/examples/i18n/en-lol/lib/belly.rb +2 -2
- data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/eo/lib/calculator.rb +2 -2
- data/examples/i18n/es/features/step_definitions/calculador_steps.rb +10 -5
- data/examples/i18n/es/lib/calculador.rb +2 -2
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +10 -5
- data/examples/i18n/et/lib/kalkulaator.rb +3 -3
- data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +9 -4
- data/examples/i18n/fi/lib/laskin.rb +1 -1
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +8 -8
- data/examples/i18n/fr/features/support/env.rb +7 -2
- data/examples/i18n/fr/lib/calculatrice.rb +2 -2
- data/examples/i18n/he/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/he/lib/calculator.rb +1 -1
- data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/hi/lib/calculator.rb +1 -1
- data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +9 -5
- data/examples/i18n/ht/lib/kalkilatris.rb +2 -2
- data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/hu/lib/calculator.rb +1 -1
- data/examples/i18n/id/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/id/lib/calculator.rb +2 -2
- data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +10 -5
- data/examples/i18n/it/lib/calcolatrice.rb +3 -3
- data/examples/i18n/ja/features/step_definitions/calculator_steps.rb +3 -3
- data/examples/i18n/ja/features/support/env.rb +7 -2
- data/examples/i18n/ja/lib/calculator.rb +2 -2
- data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/ko/lib/calculator.rb +2 -2
- data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/lt/lib/calculator.rb +2 -2
- data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/lv/lib/calculator.rb +2 -2
- data/examples/i18n/no/features/step_definitions/kalkulator_steps.rb +3 -3
- data/examples/i18n/no/features/support/env.rb +7 -2
- data/examples/i18n/no/lib/kalkulator.rb +2 -2
- data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/pl/features/support/env.rb +6 -1
- data/examples/i18n/pl/lib/calculator.rb +2 -2
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +3 -3
- data/examples/i18n/pt/features/support/env.rb +7 -2
- data/examples/i18n/pt/lib/calculadora.rb +1 -1
- data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +11 -6
- data/examples/i18n/ro/lib/calculator.rb +1 -1
- data/examples/i18n/ru/features/step_definitions/calculator_steps.rb +5 -5
- data/examples/i18n/ru/features/support/env.rb +6 -1
- data/examples/i18n/ru/lib/calculator.rb +2 -1
- data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/sk/lib/calculator.rb +2 -2
- data/examples/i18n/sr-Cyrl/features/step_definitions/calculator_steps.rb +3 -3
- data/examples/i18n/sr-Cyrl/features/support/env.rb +7 -2
- data/examples/i18n/sr-Cyrl/lib/calculator.rb +2 -2
- data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/sr-Latn/lib/calculator.rb +2 -2
- data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +9 -4
- data/examples/i18n/sv/lib/kalkulator.rb +2 -2
- data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +10 -5
- data/examples/i18n/tr/lib/hesap_makinesi.rb +2 -2
- data/examples/i18n/uk/features/step_definitions/calculator_steps.rb +4 -4
- data/examples/i18n/uk/features/support/env.rb +6 -1
- data/examples/i18n/uk/lib/calculator.rb +2 -1
- data/examples/i18n/uz/features/step_definitions/calculator_steps.rb +4 -4
- data/examples/i18n/uz/features/support/env.rb +6 -1
- data/examples/i18n/uz/lib/calculator.rb +2 -1
- data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +11 -6
- data/examples/i18n/zh-CN/lib/calculator.rb +2 -2
- data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/zh-TW/lib/calculator.rb +2 -2
- data/examples/rspec_doubles/features/step_definitions/calvin_steps.rb +3 -3
- data/examples/sinatra/features/step_definitions/add_steps.rb +4 -4
- data/examples/sinatra/features/support/env.rb +6 -1
- data/examples/tcl/features/step_definitions/fib_steps.rb +2 -2
- data/examples/tcl/features/support/env.rb +2 -1
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +4 -4
- data/examples/watir/features/step_definitions/search_steps.rb +6 -5
- data/examples/watir/features/support/env.rb +5 -1
- data/examples/watir/features/support/screenshots.rb +5 -5
- data/features/docs/api/list_step_defs_as_json.feature +21 -7
- data/features/docs/api/listen_for_events.feature +9 -8
- data/features/docs/api/run_cli_main_with_existing_runtime.feature +1 -0
- data/features/docs/cli/dry_run.feature +3 -0
- data/features/docs/cli/execute_with_tag_filter.feature +8 -6
- data/features/docs/cli/fail_fast.feature +2 -0
- data/features/docs/cli/help.feature +8 -0
- data/features/docs/{gherkin/language_help.feature → cli/i18n.feature} +6 -6
- data/features/docs/cli/randomize.feature +2 -2
- data/features/docs/cli/retry_failing_tests.feature +75 -15
- data/features/docs/cli/run_scenarios_matching_name.feature +1 -0
- data/features/docs/cli/specifying_multiple_formatters.feature +3 -0
- data/features/docs/cli/strict_mode.feature +6 -0
- data/features/docs/defining_steps/ambiguous_steps.feature +89 -0
- data/features/docs/defining_steps/nested_steps.feature +5 -1
- data/features/docs/defining_steps/nested_steps_i18n.feature +3 -0
- data/features/docs/defining_steps/nested_steps_with_second_arg.feature +2 -0
- data/features/docs/defining_steps/printing_messages.feature +1 -2
- data/features/docs/defining_steps/skip_scenario.feature +1 -34
- data/features/docs/defining_steps/snippets.feature +18 -18
- data/features/docs/events/gherkin_source_read_event.feature +43 -0
- data/features/docs/events/step_activated_event.feature +36 -0
- data/features/docs/events/step_definition_registered_event.feature +29 -0
- data/features/docs/events/test_case_finished_event.feature +35 -0
- data/features/docs/events/test_case_started_event.feature +54 -0
- data/features/docs/events/test_run_finished_event.feature +40 -0
- data/features/docs/events/test_run_started_event.feature +41 -0
- data/features/docs/events/test_step_finished_event.feature +47 -0
- data/features/docs/events/test_step_started_event.feature +43 -0
- data/features/docs/exception_in_after_hook.feature +3 -2
- data/features/docs/exception_in_after_step_hook.feature +2 -0
- data/features/docs/exception_in_around_hook.feature +2 -0
- data/features/docs/exception_in_before_hook.feature +3 -1
- data/features/docs/extending_cucumber/custom_formatter.feature +12 -48
- data/features/docs/formatters/json_formatter.feature +4 -4
- data/features/docs/formatters/junit_formatter.feature +7 -6
- data/features/docs/formatters/pretty_formatter.feature +1 -0
- data/features/docs/formatters/progress_formatter.feature +1 -0
- data/features/docs/formatters/rerun_formatter.feature +2 -0
- data/features/docs/formatters/summary_formatter.feature +35 -0
- data/features/docs/formatters/usage_formatter.feature +3 -0
- data/features/docs/getting_started.feature +2 -1
- data/features/docs/gherkin/background.feature +5 -5
- data/features/docs/gherkin/doc_strings.feature +2 -0
- data/features/docs/gherkin/expand_option_for_outlines.feature +1 -0
- data/features/docs/gherkin/outlines.feature +6 -4
- data/features/docs/gherkin/unicode_table.feature +2 -1
- data/features/docs/gherkin/using_descriptions.feature +1 -0
- data/features/docs/gherkin/using_star_notation.feature +1 -1
- data/features/docs/post_configuration_hook.feature +1 -17
- data/features/docs/rake_task.feature +5 -0
- data/features/docs/raketask.feature +3 -1
- data/features/docs/work_in_progress.feature +5 -2
- data/features/docs/writing_support_code/after_step_hooks.feature +3 -1
- data/features/docs/writing_support_code/around_hooks.feature +6 -0
- data/features/docs/writing_support_code/before_hook.feature +1 -0
- data/features/docs/writing_support_code/hook_order.feature +3 -1
- data/features/docs/writing_support_code/parameter_types.feature +53 -0
- data/features/docs/writing_support_code/tagged_hooks.feature +1 -1
- data/features/docs/writing_support_code/world.feature +129 -0
- data/features/lib/step_definitions/aruba_steps.rb +5 -10
- data/features/lib/step_definitions/cli_steps.rb +4 -0
- data/features/lib/step_definitions/cucumber_steps.rb +9 -12
- data/features/lib/step_definitions/iso-8859-1_steps.rb +9 -5
- data/features/lib/step_definitions/json_steps.rb +2 -1
- data/features/lib/step_definitions/junit_steps.rb +2 -1
- data/features/lib/step_definitions/language_steps.rb +3 -2
- data/features/lib/step_definitions/profile_steps.rb +7 -6
- data/features/lib/step_definitions/retry_steps.rb +33 -13
- data/features/lib/step_definitions/ruby_steps.rb +2 -1
- data/features/lib/support/env.rb +3 -2
- data/features/lib/support/fake_wire_server.rb +17 -3
- data/features/lib/support/feature_factory.rb +2 -1
- data/features/lib/support/normalise_output.rb +14 -12
- data/features/lib/support/parameter_types.rb +5 -0
- data/gem_tasks/contributors.rake +10 -6
- data/gem_tasks/cov.rake +1 -0
- data/gem_tasks/downloads.rb +1 -0
- data/gem_tasks/environment.rake +2 -5
- data/gem_tasks/examples.rake +3 -2
- data/gem_tasks/fix_cr_lf.rake +19 -7
- data/gem_tasks/flog.rake +4 -3
- data/gem_tasks/rspec.rake +2 -1
- data/gem_tasks/sass.rake +2 -1
- data/lib/autotest/cucumber.rb +1 -0
- data/lib/autotest/cucumber_mixin.rb +17 -16
- data/lib/autotest/cucumber_rails.rb +1 -0
- data/lib/autotest/cucumber_rails_rspec.rb +1 -0
- data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
- data/lib/autotest/cucumber_rspec.rb +1 -0
- data/lib/autotest/cucumber_rspec2.rb +1 -0
- data/lib/autotest/discover.rb +3 -2
- data/lib/cucumber/cli/configuration.rb +12 -21
- data/lib/cucumber/cli/main.rb +8 -7
- data/lib/cucumber/cli/options.rb +341 -217
- data/lib/cucumber/cli/profile_loader.rb +26 -21
- data/lib/cucumber/cli/rerun_file.rb +1 -0
- data/lib/cucumber/configuration.rb +54 -37
- data/lib/cucumber/constantize.rb +2 -1
- data/lib/cucumber/core_ext/string.rb +2 -1
- data/lib/cucumber/deprecate.rb +4 -3
- data/lib/cucumber/encoding.rb +1 -0
- data/lib/cucumber/errors.rb +3 -1
- data/lib/cucumber/events/gherkin_source_read.rb +17 -0
- data/lib/cucumber/events/{step_match.rb → step_activated.rb} +5 -2
- data/lib/cucumber/events/step_definition_registered.rb +24 -0
- data/lib/cucumber/events/test_case_finished.rb +18 -0
- data/lib/cucumber/events/test_case_started.rb +15 -0
- data/lib/cucumber/events/test_run_finished.rb +12 -0
- data/lib/cucumber/events/test_run_started.rb +16 -0
- data/lib/cucumber/events/test_step_finished.rb +20 -0
- data/lib/cucumber/events/test_step_started.rb +17 -0
- data/lib/cucumber/events.rb +23 -3
- data/lib/cucumber/file_specs.rb +1 -0
- data/lib/cucumber/filters/activate_steps.rb +8 -3
- data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
- data/lib/cucumber/filters/broadcast_test_run_started_event.rb +27 -0
- data/lib/cucumber/filters/gated_receiver.rb +1 -0
- data/lib/cucumber/filters/prepare_world.rb +1 -0
- data/lib/cucumber/filters/quit.rb +1 -0
- data/lib/cucumber/filters/randomizer.rb +1 -0
- data/lib/cucumber/filters/retry.rb +4 -4
- data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -0
- data/lib/cucumber/filters/tag_limits/verifier.rb +2 -1
- data/lib/cucumber/filters/tag_limits.rb +4 -3
- data/lib/cucumber/filters.rb +3 -0
- data/lib/cucumber/formatter/ansicolor.rb +9 -11
- data/lib/cucumber/formatter/backtrace_filter.rb +21 -8
- data/lib/cucumber/formatter/console.rb +72 -66
- data/lib/cucumber/formatter/console_counts.rb +44 -0
- data/lib/cucumber/formatter/console_issues.rb +58 -0
- data/lib/cucumber/formatter/duration.rb +2 -1
- data/lib/cucumber/formatter/duration_extractor.rb +1 -0
- data/lib/cucumber/formatter/fail_fast.rb +4 -2
- data/lib/cucumber/formatter/fanout.rb +1 -0
- data/lib/cucumber/formatter/hook_query_visitor.rb +1 -0
- data/lib/cucumber/formatter/html.rb +175 -249
- data/lib/cucumber/formatter/html_builder.rb +120 -0
- data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -0
- data/lib/cucumber/formatter/inline-js.js +30 -0
- data/lib/cucumber/formatter/interceptor.rb +3 -2
- data/lib/cucumber/formatter/io.rb +2 -1
- data/lib/cucumber/formatter/json.rb +33 -30
- data/lib/cucumber/formatter/json_pretty.rb +1 -0
- data/lib/cucumber/formatter/junit.rb +26 -24
- data/lib/cucumber/formatter/legacy_api/adapter.rb +81 -69
- data/lib/cucumber/formatter/legacy_api/ast.rb +27 -22
- data/lib/cucumber/formatter/legacy_api/results.rb +7 -8
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +1 -0
- data/lib/cucumber/formatter/pretty.rb +24 -18
- data/lib/cucumber/formatter/progress.rb +55 -13
- data/lib/cucumber/formatter/rerun.rb +15 -18
- data/lib/cucumber/formatter/stepdefs.rb +1 -0
- data/lib/cucumber/formatter/steps.rb +2 -1
- data/lib/cucumber/formatter/summary.rb +43 -20
- data/lib/cucumber/formatter/unicode.rb +2 -1
- data/lib/cucumber/formatter/usage.rb +33 -28
- data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +2 -1
- data/lib/cucumber/gherkin/formatter/escaping.rb +2 -1
- data/lib/cucumber/gherkin/i18n.rb +1 -0
- data/lib/cucumber/gherkin/steps_parser.rb +1 -0
- data/lib/cucumber/{rb_support/rb_dsl.rb → glue/dsl.rb} +41 -30
- data/lib/cucumber/glue/hook.rb +43 -0
- data/lib/cucumber/glue/invoke_in_world.rb +70 -0
- data/lib/cucumber/glue/proto_world.rb +220 -0
- data/lib/cucumber/{rb_support/rb_language.rb → glue/registry_and_more.rb} +60 -90
- data/lib/cucumber/{rb_support → glue}/snippet.rb +64 -26
- data/lib/cucumber/glue/step_definition.rb +143 -0
- data/lib/cucumber/glue/world_factory.rb +23 -0
- data/lib/cucumber/hooks.rb +9 -8
- data/lib/cucumber/load_path.rb +1 -0
- data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +158 -0
- data/lib/cucumber/multiline_argument/data_table.rb +47 -181
- data/lib/cucumber/multiline_argument/doc_string.rb +1 -0
- data/lib/cucumber/multiline_argument.rb +6 -15
- data/lib/cucumber/platform.rb +4 -5
- data/lib/cucumber/project_initializer.rb +3 -2
- data/lib/cucumber/rake/task.rb +19 -14
- data/lib/cucumber/rspec/disable_option_parser.rb +2 -1
- data/lib/cucumber/rspec/doubles.rb +2 -1
- data/lib/cucumber/running_test_case.rb +3 -27
- data/lib/cucumber/runtime/after_hooks.rb +2 -1
- data/lib/cucumber/runtime/before_hooks.rb +1 -0
- data/lib/cucumber/runtime/for_programming_languages.rb +2 -36
- data/lib/cucumber/runtime/step_hooks.rb +1 -0
- data/lib/cucumber/runtime/support_code.rb +21 -16
- data/lib/cucumber/runtime/user_interface.rb +10 -16
- data/lib/cucumber/runtime.rb +49 -32
- data/lib/cucumber/step_argument.rb +1 -2
- data/lib/cucumber/step_definition_light.rb +2 -0
- data/lib/cucumber/step_definitions.rb +1 -0
- data/lib/cucumber/step_match.rb +30 -15
- data/lib/cucumber/step_match_search.rb +3 -3
- data/lib/cucumber/term/ansicolor.rb +2 -1
- data/lib/cucumber/unit.rb +1 -0
- data/lib/cucumber/version +1 -1
- data/lib/cucumber.rb +1 -13
- data/lib/simplecov_setup.rb +2 -1
- data/scripts/invite-collaborator +40 -0
- data/scripts/update-changelog +86 -0
- data/spec/cucumber/cli/configuration_spec.rb +109 -98
- data/spec/cucumber/cli/main_spec.rb +8 -7
- data/spec/cucumber/cli/options_spec.rb +114 -79
- data/spec/cucumber/cli/profile_loader_spec.rb +25 -5
- data/spec/cucumber/cli/rerun_spec.rb +21 -20
- data/spec/cucumber/configuration_spec.rb +48 -47
- data/spec/cucumber/constantize_spec.rb +3 -2
- data/spec/cucumber/events_spec.rb +9 -0
- data/spec/cucumber/file_specs_spec.rb +26 -25
- data/spec/cucumber/filters/activate_steps_spec.rb +25 -22
- data/spec/cucumber/filters/gated_receiver_spec.rb +7 -6
- data/spec/cucumber/filters/retry_spec.rb +42 -23
- data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +12 -11
- data/spec/cucumber/filters/tag_limits/verifier_spec.rb +15 -14
- data/spec/cucumber/filters/tag_limits_spec.rb +9 -8
- data/spec/cucumber/formatter/ansicolor_spec.rb +10 -9
- data/spec/cucumber/formatter/backtrace_filter_spec.rb +32 -0
- data/spec/cucumber/formatter/console_counts_spec.rb +14 -0
- data/spec/cucumber/formatter/duration_spec.rb +4 -3
- data/spec/cucumber/formatter/fail_fast_spec.rb +27 -27
- data/spec/cucumber/formatter/html_spec.rb +65 -60
- data/spec/cucumber/formatter/interceptor_spec.rb +1 -0
- data/spec/cucumber/formatter/json_spec.rb +71 -97
- data/spec/cucumber/formatter/junit_spec.rb +46 -47
- data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +134 -141
- data/spec/cucumber/formatter/pretty_spec.rb +105 -117
- data/spec/cucumber/formatter/progress_spec.rb +22 -21
- data/spec/cucumber/formatter/rerun_spec.rb +70 -64
- data/spec/cucumber/formatter/spec_helper.rb +14 -12
- data/spec/cucumber/{rb_support/rb_world_spec.rb → glue/proto_world_spec.rb} +22 -6
- data/spec/cucumber/glue/registry_and_more_spec.rb +213 -0
- data/spec/cucumber/{rb_support → glue}/snippet_spec.rb +62 -25
- data/spec/cucumber/glue/step_definition_spec.rb +207 -0
- data/spec/cucumber/hooks_spec.rb +5 -4
- data/spec/cucumber/multiline_argument/data_table_spec.rb +179 -129
- data/spec/cucumber/project_initializer_spec.rb +12 -11
- data/spec/cucumber/rake/forked_spec.rb +22 -17
- data/spec/cucumber/rake/task_spec.rb +21 -20
- data/spec/cucumber/running_test_case_spec.rb +36 -35
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +2 -30
- data/spec/cucumber/runtime/support_code_spec.rb +1 -0
- data/spec/cucumber/runtime_spec.rb +3 -2
- data/spec/cucumber/step_argument_spec.rb +6 -5
- data/spec/cucumber/step_match_search_spec.rb +32 -41
- data/spec/cucumber/step_match_spec.rb +34 -33
- data/spec/cucumber/world/pending_spec.rb +12 -11
- data/spec/spec_helper.rb +1 -0
- data/spec/support/standard_step_actions.rb +2 -1
- metadata +132 -61
- data/features/docs/formatters/debug_formatter.feature +0 -47
- data/features/docs/formatters/formatter_step_file_colon_line.feature +0 -44
- data/features/docs/writing_support_code/transforms.feature +0 -98
- data/features/lib/step_definitions/wire_steps.rb +0 -58
- data/gem_tasks/cucumber.rake +0 -25
- data/lib/cucumber/ast.rb +0 -13
- data/lib/cucumber/core_ext/instance_exec.rb +0 -70
- data/lib/cucumber/events/after_test_case.rb +0 -25
- data/lib/cucumber/events/after_test_step.rb +0 -30
- data/lib/cucumber/events/before_test_case.rb +0 -18
- data/lib/cucumber/events/before_test_step.rb +0 -23
- data/lib/cucumber/events/bus.rb +0 -86
- data/lib/cucumber/events/finished_testing.rb +0 -9
- data/lib/cucumber/formatter/debug.rb +0 -35
- data/lib/cucumber/formatter/event_bus_report.rb +0 -38
- data/lib/cucumber/rb_support/rb_hook.rb +0 -19
- data/lib/cucumber/rb_support/rb_step_definition.rb +0 -131
- data/lib/cucumber/rb_support/rb_transform.rb +0 -59
- data/lib/cucumber/rb_support/rb_world.rb +0 -149
- data/spec/cucumber/core_ext/instance_exec_spec.rb +0 -4
- data/spec/cucumber/events/bus_spec.rb +0 -94
- data/spec/cucumber/formatter/debug_spec.rb +0 -64
- data/spec/cucumber/formatter/event_bus_report_spec.rb +0 -88
- data/spec/cucumber/rb_support/rb_language_spec.rb +0 -243
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +0 -199
- data/spec/cucumber/rb_support/rb_transform_spec.rb +0 -46
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
[
|
|
137
|
+
['--no-profile', '-P'].each do |flag|
|
|
125
138
|
context 'when none is specified with #{flag}' do
|
|
126
|
-
it
|
|
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
|
|
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
|
|
152
|
+
expect(out.string).to match(/Disabling profiles.../)
|
|
140
153
|
end
|
|
141
154
|
end
|
|
142
155
|
end
|
|
143
156
|
|
|
144
|
-
it
|
|
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
|
|
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
|
|
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",
|
|
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
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
254
|
-
expect(-> { config.parse!(%w{--format pretty --format progress}) }).to raise_error(
|
|
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
|
|
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(
|
|
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
|
|
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 [[
|
|
278
|
+
expect(config.formats).to eq [['pretty', {}, out]]
|
|
266
279
|
end
|
|
267
280
|
|
|
268
|
-
it
|
|
269
|
-
expect(-> { config.parse!(%w{--format pretty --out file1 --format progress --out file1}) }).to raise_error(
|
|
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
|
|
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(
|
|
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
|
|
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 [[
|
|
293
|
+
expect(config.formats).to eq [['progress', {}, 'file1'], ['profile', {}, 'file2']]
|
|
281
294
|
end
|
|
282
295
|
|
|
283
|
-
it
|
|
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 [[
|
|
299
|
+
expect(config.formats).to eq [['pretty', {}, out], ['html', {}, 'file']]
|
|
287
300
|
end
|
|
288
301
|
|
|
289
|
-
it
|
|
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 [[
|
|
305
|
+
expect(config.formats).to eq [['html', {}, 'file1'], ['html', {}, 'file2']]
|
|
293
306
|
end
|
|
294
307
|
|
|
295
|
-
it
|
|
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
|
|
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
|
|
321
|
+
describe '--backtrace' do
|
|
309
322
|
before do
|
|
310
323
|
Cucumber.use_full_backtrace = false
|
|
311
324
|
end
|
|
312
325
|
|
|
313
|
-
it
|
|
326
|
+
it 'shows full backtrace when --backtrace is present' do
|
|
314
327
|
Main.new(['--backtrace'])
|
|
315
328
|
begin
|
|
316
|
-
expect(
|
|
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
|
|
328
|
-
config.parse!(['--name',
|
|
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
|
|
335
|
-
config.parse!(['-n',
|
|
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
|
|
342
|
-
config.parse!([
|
|
354
|
+
it 'should allow specifying environment variables on the command line' do
|
|
355
|
+
config.parse!(['foo=bar'])
|
|
343
356
|
|
|
344
|
-
expect(ENV[
|
|
357
|
+
expect(ENV['foo']).to eq 'bar'
|
|
345
358
|
expect(config.paths).not_to include('foo=bar')
|
|
346
359
|
end
|
|
347
360
|
|
|
348
|
-
it
|
|
361
|
+
it 'allows specifying environment variables in profiles' do
|
|
349
362
|
given_cucumber_yml_defined_as({'selenium' => 'RAILS_ENV=selenium'})
|
|
350
|
-
config.parse!([
|
|
363
|
+
config.parse!(['--profile', 'selenium'])
|
|
351
364
|
|
|
352
|
-
expect(ENV[
|
|
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
|
|
357
|
-
|
|
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.
|
|
373
|
+
expect(config.tag_expressions).to be_empty
|
|
363
374
|
end
|
|
364
375
|
|
|
365
|
-
it
|
|
376
|
+
it 'returns an expression when tags are specified' do
|
|
366
377
|
config.parse!(['--tags','@foo'])
|
|
367
378
|
|
|
368
|
-
expect(config.
|
|
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
|
|
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
|
|
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({
|
|
393
|
+
expect(config.tag_limits).to eq({ '@foo' => 1 })
|
|
383
394
|
end
|
|
384
395
|
end
|
|
385
396
|
|
|
386
|
-
describe
|
|
387
|
-
it
|
|
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
|
|
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
|
|
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
|
|
408
|
-
it
|
|
409
|
-
config.parse!([
|
|
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
|
|
415
|
-
config.parse!([
|
|
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
|
|
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 :
|
|
434
|
+
expect(config.snippet_type).to eq :cucumber_expression
|
|
424
435
|
end
|
|
425
436
|
end
|
|
426
437
|
|
|
427
|
-
describe
|
|
428
|
-
it
|
|
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
|
|
20
|
-
context
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
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!
|