square-cucumber 0.3.12.2
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.
- data/History.txt +830 -0
- data/License.txt +20 -0
- data/Manifest.txt +410 -0
- data/README.txt +4 -0
- data/Rakefile +9 -0
- data/bin/cucumber +17 -0
- data/config/hoe.rb +76 -0
- data/config/requirements.rb +15 -0
- data/cucumber.yml +2 -0
- data/examples/cs/README.textile +1 -0
- data/examples/cs/Rakefile +12 -0
- data/examples/cs/compile.bat +1 -0
- data/examples/cs/features/addition.feature +16 -0
- data/examples/cs/features/step_definitons/calculator_steps.rb +19 -0
- data/examples/cs/src/demo/Calculator.cs +20 -0
- data/examples/dos_line_endings/Rakefile +6 -0
- data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
- data/examples/i18n/README.textile +18 -0
- data/examples/i18n/Rakefile +30 -0
- data/examples/i18n/ar/Rakefile +6 -0
- data/examples/i18n/ar/features/addition.feature +17 -0
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/ar/lib/calculator.rb +11 -0
- data/examples/i18n/bg/Rakefile +6 -0
- data/examples/i18n/bg/features/addition.feature +12 -0
- data/examples/i18n/bg/features/consecutive_calculations.feature +19 -0
- data/examples/i18n/bg/features/division.feature +17 -0
- data/examples/i18n/bg/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/bg/features/support/env.rb +6 -0
- data/examples/i18n/bg/features/support/world.rb +8 -0
- data/examples/i18n/bg/lib/calculator.rb +24 -0
- data/examples/i18n/cat/Rakefile +6 -0
- data/examples/i18n/cat/features/step_definitons/calculator_steps.rb +21 -0
- data/examples/i18n/cat/features/suma.feature +17 -0
- data/examples/i18n/cat/lib/calculadora.rb +16 -0
- data/examples/i18n/da/Rakefile +6 -0
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +24 -0
- data/examples/i18n/da/features/summering.feature +18 -0
- data/examples/i18n/da/lib/kalkulator.rb +11 -0
- data/examples/i18n/de/Rakefile +6 -0
- data/examples/i18n/de/features/addition.feature +17 -0
- data/examples/i18n/de/features/division.feature +10 -0
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/de/lib/calculator.rb +14 -0
- data/examples/i18n/en-lol/Rakefile +6 -0
- data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +16 -0
- data/examples/i18n/en-lol/features/stuffing.feature +8 -0
- data/examples/i18n/en-lol/features/support/env.rb +8 -0
- data/examples/i18n/en-lol/lib/basket.rb +12 -0
- data/examples/i18n/en-lol/lib/belly.rb +11 -0
- data/examples/i18n/en/Rakefile +6 -0
- data/examples/i18n/en/features/addition.feature +17 -0
- data/examples/i18n/en/features/division.feature +10 -0
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/en/lib/calculator.rb +14 -0
- data/examples/i18n/es/Rakefile +6 -0
- data/examples/i18n/es/features/adicion.feature +17 -0
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +21 -0
- data/examples/i18n/es/lib/calculador.rb +14 -0
- data/examples/i18n/et/Rakefile +6 -0
- data/examples/i18n/et/features/jagamine.feature +10 -0
- data/examples/i18n/et/features/liitmine.feature +17 -0
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +24 -0
- data/examples/i18n/et/lib/kalkulaator.rb +14 -0
- data/examples/i18n/fi/Rakefile +6 -0
- data/examples/i18n/fi/features/jakolasku.feature +10 -0
- data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +24 -0
- data/examples/i18n/fi/features/yhteenlasku.feature +16 -0
- data/examples/i18n/fi/lib/laskin.rb +14 -0
- data/examples/i18n/fr/Rakefile +6 -0
- data/examples/i18n/fr/features/addition.feature +18 -0
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +25 -0
- data/examples/i18n/fr/lib/calculatrice.rb +10 -0
- data/examples/i18n/he/Rakefile +6 -0
- data/examples/i18n/he/features/addition.feature +17 -0
- data/examples/i18n/he/features/division.feature +10 -0
- data/examples/i18n/he/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/he/lib/calculator.rb +14 -0
- data/examples/i18n/hu/Rakefile +6 -0
- data/examples/i18n/hu/features/addition.feature +17 -0
- data/examples/i18n/hu/features/division.feature +10 -0
- data/examples/i18n/hu/features/step_definitons/calculator_steps.rb +25 -0
- data/examples/i18n/hu/lib/calculator.rb +14 -0
- data/examples/i18n/id/Rakefile +6 -0
- data/examples/i18n/id/features/addition.feature +17 -0
- data/examples/i18n/id/features/division.feature +10 -0
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/id/lib/calculator.rb +14 -0
- data/examples/i18n/it/Rakefile +6 -0
- data/examples/i18n/it/features/somma.feature +11 -0
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +24 -0
- data/examples/i18n/it/lib/calcolatrice.rb +11 -0
- data/examples/i18n/ja/Rakefile +6 -0
- data/examples/i18n/ja/features/addition.feature +17 -0
- data/examples/i18n/ja/features/division.feature +10 -0
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/ja/lib/calculator.rb +14 -0
- data/examples/i18n/ko/Rakefile +6 -0
- data/examples/i18n/ko/features/addition.feature +17 -0
- data/examples/i18n/ko/features/division.feature +11 -0
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/ko/lib/calculator.rb +14 -0
- data/examples/i18n/lt/Rakefile +6 -0
- data/examples/i18n/lt/features/addition.feature +17 -0
- data/examples/i18n/lt/features/division.feature +10 -0
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/lt/lib/calculator.rb +14 -0
- data/examples/i18n/lv/Rakefile +6 -0
- data/examples/i18n/lv/features/addition.feature +17 -0
- data/examples/i18n/lv/features/division.feature +10 -0
- data/examples/i18n/lv/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/lv/lib/calculator.rb +14 -0
- data/examples/i18n/no/Rakefile +6 -0
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +17 -0
- data/examples/i18n/no/features/summering.feature +19 -0
- data/examples/i18n/no/features/support/env.rb +6 -0
- data/examples/i18n/no/lib/kalkulator.rb +11 -0
- data/examples/i18n/pl/Rakefile +6 -0
- data/examples/i18n/pl/features/addition.feature +17 -0
- data/examples/i18n/pl/features/division.feature +10 -0
- data/examples/i18n/pl/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/pl/features/support/env.rb +6 -0
- data/examples/i18n/pl/lib/calculator.rb +14 -0
- data/examples/i18n/pt/Rakefile +6 -0
- data/examples/i18n/pt/features/adicao.feature +11 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +20 -0
- data/examples/i18n/pt/features/support/env.rb +6 -0
- data/examples/i18n/pt/lib/calculadora.rb +10 -0
- data/examples/i18n/ro/Rakefile +6 -0
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/ro/features/suma.feature +11 -0
- data/examples/i18n/ro/lib/calculator.rb +11 -0
- data/examples/i18n/ru/Rakefile +6 -0
- data/examples/i18n/ru/features/addition.feature +11 -0
- data/examples/i18n/ru/features/consecutive_calculations.feature +17 -0
- data/examples/i18n/ru/features/division.feature +16 -0
- data/examples/i18n/ru/features/step_definitons/calculator_steps.rb +19 -0
- data/examples/i18n/ru/features/support/env.rb +6 -0
- data/examples/i18n/ru/features/support/world.rb +8 -0
- data/examples/i18n/ru/lib/calculator.rb +24 -0
- data/examples/i18n/se/Rakefile +6 -0
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +24 -0
- data/examples/i18n/se/features/summering.feature +18 -0
- data/examples/i18n/se/lib/kalkulator.rb +11 -0
- data/examples/i18n/sk/Rakefile +6 -0
- data/examples/i18n/sk/features/addition.feature +17 -0
- data/examples/i18n/sk/features/division.feature +10 -0
- data/examples/i18n/sk/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/sk/lib/calculator.rb +14 -0
- data/examples/i18n/zh-CN/Rakefile +6 -0
- data/examples/i18n/zh-CN/features/addition.feature +18 -0
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +26 -0
- data/examples/i18n/zh-CN/lib/calculator.rb +10 -0
- data/examples/i18n/zh-TW/Rakefile +6 -0
- data/examples/i18n/zh-TW/features/addition.feature +17 -0
- data/examples/i18n/zh-TW/features/division.feature +11 -0
- data/examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/zh-TW/lib/calculator.rb +14 -0
- data/examples/java/README.textile +18 -0
- data/examples/java/build.xml +33 -0
- data/examples/java/features/hello.feature +11 -0
- data/examples/java/features/step_definitons/hello_steps.rb +23 -0
- data/examples/java/features/step_definitons/tree_steps.rb +14 -0
- data/examples/java/features/tree.feature +9 -0
- data/examples/java/src/cucumber/demo/Hello.java +16 -0
- data/examples/junit/features/one_passing_one_failing.feature +8 -0
- data/examples/junit/features/pending.feature +5 -0
- data/examples/junit/features/step_definitions/steps.rb +11 -0
- data/examples/pure_java/README.textile +5 -0
- data/examples/selenium/Rakefile +6 -0
- data/examples/selenium/features/search.feature +9 -0
- data/examples/selenium/features/step_definitons/search_steps.rb +13 -0
- data/examples/selenium/features/support/env.rb +19 -0
- data/examples/selenium_webrat/Rakefile +6 -0
- data/examples/selenium_webrat/config.ru +0 -0
- data/examples/selenium_webrat/features/search.feature +9 -0
- data/examples/selenium_webrat/features/step_definitons/search_steps.rb +13 -0
- data/examples/selenium_webrat/features/support/env.rb +45 -0
- data/examples/self_test/README.textile +6 -0
- data/examples/self_test/Rakefile +6 -0
- data/examples/self_test/features/background/background_tagged_before_on_outline.feature +12 -0
- data/examples/self_test/features/background/background_with_name.feature +7 -0
- data/examples/self_test/features/background/failing_background.feature +12 -0
- data/examples/self_test/features/background/failing_background_after_success.feature +11 -0
- data/examples/self_test/features/background/multiline_args_background.feature +32 -0
- data/examples/self_test/features/background/passing_background.feature +10 -0
- data/examples/self_test/features/background/pending_background.feature +10 -0
- data/examples/self_test/features/background/scenario_outline_failing_background.feature +16 -0
- data/examples/self_test/features/background/scenario_outline_passing_background.feature +16 -0
- data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
- data/examples/self_test/features/failing_expectation.feature +4 -0
- data/examples/self_test/features/lots_of_undefined.feature +8 -0
- data/examples/self_test/features/multiline_name.feature +27 -0
- data/examples/self_test/features/outline_sample.feature +15 -0
- data/examples/self_test/features/sample.feature +21 -0
- data/examples/self_test/features/search_sample.feature +32 -0
- data/examples/self_test/features/step_definitions/sample_steps.rb +81 -0
- data/examples/self_test/features/support/env.rb +17 -0
- data/examples/self_test/features/tons_of_cukes.feature +52 -0
- data/examples/self_test/features/undefined_multiline_args.feature +12 -0
- data/examples/sinatra/Rakefile +6 -0
- data/examples/sinatra/app.rb +14 -0
- data/examples/sinatra/features/add.feature +11 -0
- data/examples/sinatra/features/step_definitions/add_steps.rb +15 -0
- data/examples/sinatra/features/support/env.rb +28 -0
- data/examples/sinatra/views/add.erb +5 -0
- data/examples/sinatra/views/layout.erb +8 -0
- data/examples/test_unit/Rakefile +6 -0
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +23 -0
- data/examples/test_unit/features/test_unit.feature +9 -0
- data/examples/tickets/Rakefile +16 -0
- data/examples/tickets/features/172.feature +28 -0
- data/examples/tickets/features/177/1.feature +29 -0
- data/examples/tickets/features/177/2.feature +21 -0
- data/examples/tickets/features/177/3.feature +18 -0
- data/examples/tickets/features/180.feature +7 -0
- data/examples/tickets/features/229/tagged_hooks.feature +8 -0
- data/examples/tickets/features/229/tagged_hooks.rb +14 -0
- data/examples/tickets/features/236.feature +13 -0
- data/examples/tickets/features/241.feature +13 -0
- data/examples/tickets/features/246.feature +4 -0
- data/examples/tickets/features/248.feature +11 -0
- data/examples/tickets/features/270/back.feature +14 -0
- data/examples/tickets/features/270/back.steps.rb +14 -0
- data/examples/tickets/features/272/hooks.feature +26 -0
- data/examples/tickets/features/272/hooks_steps.rb +53 -0
- data/examples/tickets/features/279/py_string_indent.feature +25 -0
- data/examples/tickets/features/279/py_string_indent.steps.rb +12 -0
- data/examples/tickets/features/279/wrong.feature_ +11 -0
- data/examples/tickets/features/301/filter_background_tagged_hooks.feature +6 -0
- data/examples/tickets/features/301/filter_background_tagged_hooks_steps.rb +12 -0
- data/examples/tickets/features/306/only_background.feature +4 -0
- data/examples/tickets/features/lib/eatting_machine.rb +18 -0
- data/examples/tickets/features/lib/pantry.rb +20 -0
- data/examples/tickets/features/scenario_outline.feature +95 -0
- data/examples/tickets/features/step_definitons/246_steps.rb +3 -0
- data/examples/tickets/features/step_definitons/248_steps.rb +15 -0
- data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +42 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +66 -0
- data/examples/tickets/features/tickets.feature +28 -0
- data/examples/watir/README.textile +16 -0
- data/examples/watir/Rakefile +6 -0
- data/examples/watir/features/search.feature +12 -0
- data/examples/watir/features/step_definitons/search_steps.rb +22 -0
- data/examples/watir/features/support/env.rb +32 -0
- data/features/after_block_exceptions.feature +102 -0
- data/features/after_step_block_exceptions.feature +104 -0
- data/features/background.feature +311 -0
- data/features/bug_371.feature +32 -0
- data/features/cucumber_cli.feature +549 -0
- data/features/cucumber_cli_diff_disabled.feature +53 -0
- data/features/cucumber_cli_outlines.feature +109 -0
- data/features/custom_formatter.feature +11 -0
- data/features/drb_server_integration.feature +115 -0
- data/features/exclude_files.feature +20 -0
- data/features/expand.feature +49 -0
- data/features/html_formatter.feature +7 -0
- data/features/html_formatter/a.html +185 -0
- data/features/junit_formatter.feature +71 -0
- data/features/language_from_header.feature +30 -0
- data/features/multiline_names.feature +43 -0
- data/features/rake_task.feature +150 -0
- data/features/report_called_undefined_steps.feature +35 -0
- data/features/snippet.feature +22 -0
- data/features/step_definitions/cucumber_steps.rb +130 -0
- data/features/step_definitions/extra_steps.rb +2 -0
- data/features/support/env.rb +120 -0
- data/features/usage.feature +126 -0
- data/features/work_in_progress.feature +151 -0
- data/gem_tasks/deployment.rake +11 -0
- data/gem_tasks/environment.rake +7 -0
- data/gem_tasks/features.rake +10 -0
- data/gem_tasks/fix_cr_lf.rake +10 -0
- data/gem_tasks/flog.rake +4 -0
- data/gem_tasks/gemspec.rake +10 -0
- data/gem_tasks/rspec.rake +45 -0
- data/gem_tasks/sass.rake +4 -0
- data/gem_tasks/yard.rake +8 -0
- data/lib/autotest/cucumber.rb +6 -0
- data/lib/autotest/cucumber_mixin.rb +125 -0
- data/lib/autotest/cucumber_rails.rb +6 -0
- data/lib/autotest/cucumber_rails_rspec.rb +6 -0
- data/lib/autotest/cucumber_rspec.rb +6 -0
- data/lib/autotest/discover.rb +9 -0
- data/lib/cucumber.rb +11 -0
- data/lib/cucumber/ast.rb +29 -0
- data/lib/cucumber/ast/background.rb +62 -0
- data/lib/cucumber/ast/comment.rb +30 -0
- data/lib/cucumber/ast/examples.rb +26 -0
- data/lib/cucumber/ast/feature.rb +58 -0
- data/lib/cucumber/ast/feature_element.rb +57 -0
- data/lib/cucumber/ast/features.rb +30 -0
- data/lib/cucumber/ast/outline_table.rb +143 -0
- data/lib/cucumber/ast/py_string.rb +57 -0
- data/lib/cucumber/ast/scenario.rb +83 -0
- data/lib/cucumber/ast/scenario_outline.rb +93 -0
- data/lib/cucumber/ast/step.rb +112 -0
- data/lib/cucumber/ast/step_collection.rb +75 -0
- data/lib/cucumber/ast/step_invocation.rb +136 -0
- data/lib/cucumber/ast/table.rb +334 -0
- data/lib/cucumber/ast/tags.rb +33 -0
- data/lib/cucumber/ast/visitor.rb +116 -0
- data/lib/cucumber/broadcaster.rb +13 -0
- data/lib/cucumber/cli/configuration.rb +425 -0
- data/lib/cucumber/cli/drb_client.rb +20 -0
- data/lib/cucumber/cli/language_help_formatter.rb +59 -0
- data/lib/cucumber/cli/main.rb +136 -0
- data/lib/cucumber/core_ext/exception.rb +53 -0
- data/lib/cucumber/core_ext/instance_exec.rb +67 -0
- data/lib/cucumber/core_ext/proc.rb +29 -0
- data/lib/cucumber/core_ext/string.rb +48 -0
- data/lib/cucumber/feature_file.rb +47 -0
- data/lib/cucumber/filter.rb +50 -0
- data/lib/cucumber/formatter/ansicolor.rb +110 -0
- data/lib/cucumber/formatter/color_io.rb +23 -0
- data/lib/cucumber/formatter/console.rb +149 -0
- data/lib/cucumber/formatter/cucumber.css +132 -0
- data/lib/cucumber/formatter/cucumber.sass +139 -0
- data/lib/cucumber/formatter/duration.rb +10 -0
- data/lib/cucumber/formatter/html.rb +258 -0
- data/lib/cucumber/formatter/junit.rb +75 -0
- data/lib/cucumber/formatter/pretty.rb +188 -0
- data/lib/cucumber/formatter/profile.rb +77 -0
- data/lib/cucumber/formatter/progress.rb +60 -0
- data/lib/cucumber/formatter/rerun.rb +44 -0
- data/lib/cucumber/formatter/tag_cloud.rb +28 -0
- data/lib/cucumber/formatter/unicode.rb +35 -0
- data/lib/cucumber/formatter/usage.rb +85 -0
- data/lib/cucumber/formatters/unicode.rb +7 -0
- data/lib/cucumber/languages.yml +532 -0
- data/lib/cucumber/parser.rb +6 -0
- data/lib/cucumber/parser/feature.rb +1787 -0
- data/lib/cucumber/parser/feature.tt +324 -0
- data/lib/cucumber/parser/i18n.tt +42 -0
- data/lib/cucumber/parser/i18n/language.rb +80 -0
- data/lib/cucumber/parser/table.rb +414 -0
- data/lib/cucumber/parser/table.tt +71 -0
- data/lib/cucumber/parser/treetop_ext.rb +52 -0
- data/lib/cucumber/platform.rb +23 -0
- data/lib/cucumber/rails/rspec.rb +10 -0
- data/lib/cucumber/rails/world.rb +99 -0
- data/lib/cucumber/rake/task.rb +233 -0
- data/lib/cucumber/rspec_neuter.rb +23 -0
- data/lib/cucumber/step_definition.rb +122 -0
- data/lib/cucumber/step_match.rb +61 -0
- data/lib/cucumber/step_mother.rb +362 -0
- data/lib/cucumber/version.rb +10 -0
- data/lib/cucumber/webrat/mechanize_world.rb +82 -0
- data/lib/cucumber/world.rb +53 -0
- data/rails_generators/cucumber/USAGE +11 -0
- data/rails_generators/cucumber/cucumber_generator.rb +66 -0
- data/rails_generators/cucumber/templates/cucumber +8 -0
- data/rails_generators/cucumber/templates/cucumber.rake +20 -0
- data/rails_generators/cucumber/templates/cucumber_environment.rb +23 -0
- data/rails_generators/cucumber/templates/env.rb +26 -0
- data/rails_generators/cucumber/templates/paths.rb +27 -0
- data/rails_generators/cucumber/templates/spork_env.rb +36 -0
- data/rails_generators/cucumber/templates/webrat_steps.rb +147 -0
- data/rails_generators/feature/USAGE +12 -0
- data/rails_generators/feature/feature_generator.rb +40 -0
- data/rails_generators/feature/templates/feature.erb +31 -0
- data/rails_generators/feature/templates/steps.erb +20 -0
- data/spec/cucumber/ast/background_spec.rb +50 -0
- data/spec/cucumber/ast/feature_element_spec.rb +40 -0
- data/spec/cucumber/ast/feature_factory.rb +63 -0
- data/spec/cucumber/ast/feature_spec.rb +38 -0
- data/spec/cucumber/ast/py_string_spec.rb +51 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +67 -0
- data/spec/cucumber/ast/scenario_spec.rb +38 -0
- data/spec/cucumber/ast/step_collection_spec.rb +17 -0
- data/spec/cucumber/ast/step_spec.rb +66 -0
- data/spec/cucumber/ast/table_spec.rb +186 -0
- data/spec/cucumber/ast/visitor_spec.rb +27 -0
- data/spec/cucumber/broadcaster_spec.rb +15 -0
- data/spec/cucumber/cli/configuration_spec.rb +396 -0
- data/spec/cucumber/cli/drb_client_spec.rb +43 -0
- data/spec/cucumber/cli/main_spec.rb +140 -0
- data/spec/cucumber/core_ext/proc_spec.rb +54 -0
- data/spec/cucumber/core_ext/string_spec.rb +42 -0
- data/spec/cucumber/formatter/ansicolor_spec.rb +35 -0
- data/spec/cucumber/formatter/color_io_spec.rb +27 -0
- data/spec/cucumber/formatter/duration_spec.rb +22 -0
- data/spec/cucumber/formatter/progress_spec.rb +36 -0
- data/spec/cucumber/parser/feature_parser_spec.rb +387 -0
- data/spec/cucumber/parser/table_parser_spec.rb +48 -0
- data/spec/cucumber/rails/stubs/mini_rails.rb +18 -0
- data/spec/cucumber/rails/stubs/test_help.rb +1 -0
- data/spec/cucumber/rails/world_spec.rb +11 -0
- data/spec/cucumber/sell_cucumbers.feature +19 -0
- data/spec/cucumber/step_definition_spec.rb +101 -0
- data/spec/cucumber/step_mother_spec.rb +155 -0
- data/spec/cucumber/treetop_parser/empty_feature.feature +4 -0
- data/spec/cucumber/treetop_parser/empty_scenario.feature +9 -0
- data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
- data/spec/cucumber/treetop_parser/fit_scenario.feature +8 -0
- data/spec/cucumber/treetop_parser/given_scenario.feature +9 -0
- data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
- data/spec/cucumber/treetop_parser/multiline_steps.feature +17 -0
- data/spec/cucumber/treetop_parser/multiple_tables.feature +27 -0
- data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
- data/spec/cucumber/treetop_parser/spaces.feature +12 -0
- data/spec/cucumber/treetop_parser/test_dos.feature +25 -0
- data/spec/cucumber/treetop_parser/with_comments.feature +10 -0
- data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
- data/spec/cucumber/world/pending_spec.rb +47 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +13 -0
- metadata +504 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Cucumber
|
|
2
|
+
module Ast
|
|
3
|
+
# Holds the names of tags parsed from a feature file:
|
|
4
|
+
#
|
|
5
|
+
# @invoice @release_2
|
|
6
|
+
#
|
|
7
|
+
# This gets stored internally as <tt>["invoice", "release_2"]</tt>
|
|
8
|
+
#
|
|
9
|
+
class Tags
|
|
10
|
+
def self.strip_prefix(tag_name)
|
|
11
|
+
tag_name =~ /^@(.*)/ ? $1 : tag_name
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def initialize(line, tag_names)
|
|
15
|
+
@line, @tag_names = line, tag_names
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def accept(visitor)
|
|
19
|
+
@tag_names.each do |tag_name|
|
|
20
|
+
visitor.visit_tag_name(tag_name)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def accept_hook?(hook)
|
|
25
|
+
hook.matches_tag_names?(@tag_names)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def to_sexp
|
|
29
|
+
@tag_names.map{|tag_name| [:tag, tag_name]}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
module Cucumber
|
|
2
|
+
module Ast
|
|
3
|
+
# A dumb visitor that implements the whole Visitor API and just walks the tree.
|
|
4
|
+
class Visitor
|
|
5
|
+
attr_accessor :options
|
|
6
|
+
attr_reader :step_mother
|
|
7
|
+
|
|
8
|
+
def initialize(step_mother)
|
|
9
|
+
@options = {}
|
|
10
|
+
@step_mother = step_mother
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def matches_scenario_names?(node)
|
|
14
|
+
scenario_name_regexps = options[:name_regexps] || []
|
|
15
|
+
scenario_name_regexps.empty? || node.matches_scenario_names?(scenario_name_regexps)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def visit_features(features)
|
|
19
|
+
features.accept(self)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def visit_feature(feature)
|
|
23
|
+
feature.accept(self)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def visit_comment(comment)
|
|
27
|
+
comment.accept(self)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def visit_comment_line(comment_line)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def visit_tags(tags)
|
|
34
|
+
tags.accept(self)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def visit_tag_name(tag_name)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def visit_feature_name(name)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# +feature_element+ is either Scenario or ScenarioOutline
|
|
44
|
+
def visit_feature_element(feature_element)
|
|
45
|
+
feature_element.accept(self)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def visit_background(background)
|
|
49
|
+
background.accept(self)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def visit_background_name(keyword, name, file_colon_line, source_indent)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def visit_examples_array(examples_array)
|
|
56
|
+
examples_array.accept(self)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def visit_examples(examples)
|
|
60
|
+
examples.accept(self)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def visit_examples_name(keyword, name)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def visit_outline_table(outline_table)
|
|
67
|
+
outline_table.accept(self)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def visit_scenario_name(keyword, name, file_colon_line, source_indent)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def visit_steps(steps)
|
|
74
|
+
steps.accept(self)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def visit_step(step)
|
|
78
|
+
step.accept(self)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
|
82
|
+
visit_step_name(keyword, step_match, status, source_indent, background)
|
|
83
|
+
visit_multiline_arg(multiline_arg) if multiline_arg
|
|
84
|
+
visit_exception(exception, status) if exception
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def visit_step_name(keyword, step_match, status, source_indent, background) #:nodoc:
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def visit_multiline_arg(multiline_arg) #:nodoc:
|
|
91
|
+
multiline_arg.accept(self)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def visit_exception(exception, status) #:nodoc:
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def visit_py_string(string)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def visit_table_row(table_row)
|
|
101
|
+
table_row.accept(self)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def visit_table_cell(table_cell)
|
|
105
|
+
table_cell.accept(self)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def visit_table_cell_value(value, width, status)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def announce(announcement)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
module Cucumber
|
|
2
|
+
module Cli
|
|
3
|
+
class YmlLoadError < StandardError; end
|
|
4
|
+
|
|
5
|
+
class Configuration
|
|
6
|
+
BUILTIN_FORMATS = {
|
|
7
|
+
'html' => 'Cucumber::Formatter::Html',
|
|
8
|
+
'pretty' => 'Cucumber::Formatter::Pretty',
|
|
9
|
+
'profile' => 'Cucumber::Formatter::Profile',
|
|
10
|
+
'progress' => 'Cucumber::Formatter::Progress',
|
|
11
|
+
'rerun' => 'Cucumber::Formatter::Rerun',
|
|
12
|
+
'usage' => 'Cucumber::Formatter::Usage',
|
|
13
|
+
'junit' => 'Cucumber::Formatter::Junit',
|
|
14
|
+
'tag_cloud' => 'Cucumber::Formatter::TagCloud',
|
|
15
|
+
'steps' => 'Cucumber::Formatter::Steps'
|
|
16
|
+
}
|
|
17
|
+
DRB_FLAG = '--drb'
|
|
18
|
+
PROFILE_SHORT_FLAG = '-p'
|
|
19
|
+
PROFILE_LONG_FLAG = '--profile'
|
|
20
|
+
|
|
21
|
+
attr_reader :paths
|
|
22
|
+
attr_reader :options
|
|
23
|
+
|
|
24
|
+
def initialize(out_stream = STDOUT, error_stream = STDERR)
|
|
25
|
+
@out_stream = out_stream
|
|
26
|
+
@error_stream = error_stream
|
|
27
|
+
|
|
28
|
+
@paths = []
|
|
29
|
+
@options = default_options
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def parse!(args)
|
|
33
|
+
args.concat(%w{--profile default}) if args.empty?
|
|
34
|
+
@args = args
|
|
35
|
+
expand_profiles_into_args
|
|
36
|
+
return if parse_drb
|
|
37
|
+
|
|
38
|
+
@args.each do |arg|
|
|
39
|
+
if arg =~ /^(\w+)=(.*)$/
|
|
40
|
+
ENV[$1] = $2
|
|
41
|
+
@args.delete(arg)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
@args.extend(::OptionParser::Arguable)
|
|
46
|
+
|
|
47
|
+
@args.options do |opts|
|
|
48
|
+
opts.banner = ["Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+", "",
|
|
49
|
+
"Examples:",
|
|
50
|
+
"cucumber examples/i18n/en/features",
|
|
51
|
+
"cucumber --language it examples/i18n/it/features/somma.feature:6:98:113",
|
|
52
|
+
"cucumber -s -i http://rubyurl.com/eeCl", "", "",
|
|
53
|
+
].join("\n")
|
|
54
|
+
opts.on("-r LIBRARY|DIR", "--require LIBRARY|DIR",
|
|
55
|
+
"Require files before executing the features. If this",
|
|
56
|
+
"option is not specified, all *.rb files that are",
|
|
57
|
+
"siblings or below the features will be loaded auto-",
|
|
58
|
+
"matically. Automatic loading is disabled when this",
|
|
59
|
+
"option is specified, and all loading becomes explicit.",
|
|
60
|
+
"Files under directories named \"support\" are always",
|
|
61
|
+
"loaded first.",
|
|
62
|
+
"This option can be specified multiple times.") do |v|
|
|
63
|
+
@options[:require] ||= []
|
|
64
|
+
@options[:require] << v
|
|
65
|
+
end
|
|
66
|
+
opts.on("-l LANG", "--language LANG",
|
|
67
|
+
"Specify language for features (Default: #{@options[:lang]})",
|
|
68
|
+
%{Run with "--language help" to see all languages},
|
|
69
|
+
%{Run with "--language LANG help" to list keywords for LANG}) do |v|
|
|
70
|
+
if v == 'help'
|
|
71
|
+
list_languages_and_exit
|
|
72
|
+
elsif args==['help']
|
|
73
|
+
list_keywords_and_exit(v)
|
|
74
|
+
else
|
|
75
|
+
@options[:lang] = v
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
opts.on("-f FORMAT", "--format FORMAT",
|
|
79
|
+
"How to format features (Default: pretty)",
|
|
80
|
+
"Available formats: #{BUILTIN_FORMATS.keys.sort.join(", ")}",
|
|
81
|
+
"FORMAT can also be the fully qualified class name of",
|
|
82
|
+
"your own custom formatter. If the class isn't loaded,",
|
|
83
|
+
"Cucumber will attempt to require a file with a relative",
|
|
84
|
+
"file name that is the underscore name of the class name.",
|
|
85
|
+
"Example: --format Foo::BarZap -> Cucumber will look for",
|
|
86
|
+
"foo/bar_zap.rb. You can place the file with this relative",
|
|
87
|
+
"path underneath your features/support directory or anywhere",
|
|
88
|
+
"on Ruby's LOAD_PATH, for example in a Ruby gem.") do |v|
|
|
89
|
+
@options[:formats] << [v, @out_stream]
|
|
90
|
+
@active_format = v
|
|
91
|
+
end
|
|
92
|
+
opts.on("-o", "--out [FILE|DIR]",
|
|
93
|
+
"Write output to a file/directory instead of STDOUT. This option",
|
|
94
|
+
"applies to the previously specified --format, or the",
|
|
95
|
+
"default format if no format is specified. Check the specific",
|
|
96
|
+
"formatter's docs to see whether to pass a file or a dir.") do |v|
|
|
97
|
+
@options[:formats] << ['pretty', nil] if @options[:formats].empty?
|
|
98
|
+
@options[:formats][-1][1] = v
|
|
99
|
+
end
|
|
100
|
+
opts.on("-t TAGS", "--tags TAGS",
|
|
101
|
+
"Only execute the features or scenarios with the specified tags.",
|
|
102
|
+
"TAGS must be comma-separated without spaces. Prefix tags with ~ to",
|
|
103
|
+
"exclude features or scenarios having that tag. Tags can be specified",
|
|
104
|
+
"with or without the @ prefix.") do |v|
|
|
105
|
+
@options[:include_tags], @options[:exclude_tags] = *parse_tags(v)
|
|
106
|
+
end
|
|
107
|
+
opts.on("-n NAME", "--name NAME",
|
|
108
|
+
"Only execute the feature elements which match part of the given name.",
|
|
109
|
+
"If this option is given more than once, it will match against all the",
|
|
110
|
+
"given names.") do |v|
|
|
111
|
+
@options[:name_regexps] << /#{v}/
|
|
112
|
+
end
|
|
113
|
+
opts.on("-e", "--exclude PATTERN", "Don't run feature files or require ruby files matching PATTERN") do |v|
|
|
114
|
+
@options[:excludes] << Regexp.new(v)
|
|
115
|
+
end
|
|
116
|
+
opts.on(PROFILE_SHORT_FLAG, "#{PROFILE_LONG_FLAG} PROFILE", "Pull commandline arguments from cucumber.yml.") do |v|
|
|
117
|
+
# Processing of this is done previsouly so that the DRb flag can be detected within profiles.
|
|
118
|
+
end
|
|
119
|
+
opts.on("-c", "--[no-]color",
|
|
120
|
+
"Whether or not to use ANSI color in the output. Cucumber decides",
|
|
121
|
+
"based on your platform and the output destination if not specified.") do |v|
|
|
122
|
+
Term::ANSIColor.coloring = v
|
|
123
|
+
end
|
|
124
|
+
opts.on("-d", "--dry-run", "Invokes formatters without executing the steps.",
|
|
125
|
+
"This also omits the loading of your support/env.rb file if it exists.",
|
|
126
|
+
"Implies --quiet.") do
|
|
127
|
+
@options[:dry_run] = true
|
|
128
|
+
@quiet = true
|
|
129
|
+
end
|
|
130
|
+
opts.on("-a", "--autoformat DIRECTORY",
|
|
131
|
+
"Reformats (pretty prints) feature files and write them to DIRECTORY.",
|
|
132
|
+
"Be careful if you choose to overwrite the originals.",
|
|
133
|
+
"Implies --dry-run --formatter pretty.") do |directory|
|
|
134
|
+
@options[:autoformat] = directory
|
|
135
|
+
Term::ANSIColor.coloring = false
|
|
136
|
+
@options[:dry_run] = true
|
|
137
|
+
@quiet = true
|
|
138
|
+
end
|
|
139
|
+
opts.on("-m", "--no-multiline",
|
|
140
|
+
"Don't print multiline strings and tables under steps.") do
|
|
141
|
+
@options[:no_multiline] = true
|
|
142
|
+
end
|
|
143
|
+
opts.on("-s", "--no-source",
|
|
144
|
+
"Don't print the file and line of the step definition with the steps.") do
|
|
145
|
+
@options[:source] = false
|
|
146
|
+
end
|
|
147
|
+
opts.on("-i", "--no-snippets", "Don't print snippets for pending steps.") do
|
|
148
|
+
@options[:snippets] = false
|
|
149
|
+
end
|
|
150
|
+
opts.on("-q", "--quiet", "Alias for --no-snippets --no-source.") do
|
|
151
|
+
@quiet = true
|
|
152
|
+
end
|
|
153
|
+
opts.on("-b", "--backtrace", "Show full backtrace for all errors.") do
|
|
154
|
+
Exception.cucumber_full_backtrace = true
|
|
155
|
+
end
|
|
156
|
+
opts.on("-S", "--strict", "Fail if there are any undefined steps.") do
|
|
157
|
+
@options[:strict] = true
|
|
158
|
+
end
|
|
159
|
+
opts.on("-w", "--wip", "Fail if there are any passing scenarios.") do
|
|
160
|
+
@options[:wip] = true
|
|
161
|
+
end
|
|
162
|
+
opts.on("-v", "--verbose", "Show the files and features loaded.") do
|
|
163
|
+
@options[:verbose] = true
|
|
164
|
+
end
|
|
165
|
+
opts.on("-g", "--guess", "Guess best match for Ambiguous steps.") do
|
|
166
|
+
@options[:guess] = true
|
|
167
|
+
end
|
|
168
|
+
opts.on("-x", "--expand", "Expand Scenario Outline Tables in output.") do
|
|
169
|
+
@options[:expand] = true
|
|
170
|
+
end
|
|
171
|
+
opts.on("--no-diff", "Disable diff output on failing expectations.") do
|
|
172
|
+
@options[:diff_enabled] = false
|
|
173
|
+
end
|
|
174
|
+
opts.on(DRB_FLAG, "Run features against a DRb server. (i.e. with the spork gem)") do
|
|
175
|
+
# Processing of this is done previsouly in order to short circuit args from being lost.
|
|
176
|
+
end
|
|
177
|
+
opts.on_tail("--version", "Show version.") do
|
|
178
|
+
@out_stream.puts VERSION::STRING
|
|
179
|
+
Kernel.exit
|
|
180
|
+
end
|
|
181
|
+
opts.on_tail("-h", "--help", "You're looking at it.") do
|
|
182
|
+
@out_stream.puts opts.help
|
|
183
|
+
Kernel.exit
|
|
184
|
+
end
|
|
185
|
+
end.parse!
|
|
186
|
+
|
|
187
|
+
arrange_formats
|
|
188
|
+
|
|
189
|
+
@options[:snippets] = true if !@quiet && @options[:snippets].nil?
|
|
190
|
+
@options[:source] = true if !@quiet && @options[:source].nil?
|
|
191
|
+
|
|
192
|
+
raise("You can't use both --strict and --wip") if @options[:strict] && @options[:wip]
|
|
193
|
+
|
|
194
|
+
# Whatever is left after option parsing is the FILE arguments
|
|
195
|
+
@paths += @args
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def verbose?
|
|
199
|
+
@options[:verbose]
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def strict?
|
|
203
|
+
@options[:strict]
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
def wip?
|
|
207
|
+
@options[:wip]
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def guess?
|
|
211
|
+
@options[:guess]
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def diff_enabled?
|
|
215
|
+
@options[:diff_enabled]
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def drb?
|
|
219
|
+
@drb
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def parse_tags(tag_string)
|
|
223
|
+
tag_names = tag_string.split(",")
|
|
224
|
+
excludes, includes = tag_names.partition{|tag| tag =~ /^~/}
|
|
225
|
+
excludes = excludes.map{|tag| tag[1..-1]}
|
|
226
|
+
|
|
227
|
+
# Strip @
|
|
228
|
+
includes = includes.map{|tag| Ast::Tags.strip_prefix(tag)}
|
|
229
|
+
excludes = excludes.map{|tag| Ast::Tags.strip_prefix(tag)}
|
|
230
|
+
[includes, excludes]
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def build_formatter_broadcaster(step_mother)
|
|
234
|
+
return Formatter::Pretty.new(step_mother, nil, @options) if @options[:autoformat]
|
|
235
|
+
formatters = @options[:formats].map do |format_and_out|
|
|
236
|
+
format = format_and_out[0]
|
|
237
|
+
out = format_and_out[1]
|
|
238
|
+
if String === out # file name
|
|
239
|
+
unless File.directory?(out)
|
|
240
|
+
out = File.open(out, Cucumber.file_mode('w'))
|
|
241
|
+
at_exit do
|
|
242
|
+
out.flush
|
|
243
|
+
out.close
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
begin
|
|
249
|
+
formatter_class = formatter_class(format)
|
|
250
|
+
formatter_class.new(step_mother, out, @options)
|
|
251
|
+
rescue Exception => e
|
|
252
|
+
e.message << "\nError creating formatter: #{format}"
|
|
253
|
+
raise e
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
broadcaster = Broadcaster.new(formatters)
|
|
258
|
+
broadcaster.options = @options
|
|
259
|
+
return broadcaster
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def formatter_class(format)
|
|
263
|
+
if(builtin = BUILTIN_FORMATS[format])
|
|
264
|
+
constantize(builtin)
|
|
265
|
+
else
|
|
266
|
+
constantize(format)
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def files_to_require
|
|
271
|
+
requires = @options[:require] || feature_dirs
|
|
272
|
+
files = requires.map do |path|
|
|
273
|
+
path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
|
|
274
|
+
path = path.gsub(/\/$/, '') # Strip trailing slash.
|
|
275
|
+
File.directory?(path) ? Dir["#{path}/**/*.rb"] : path
|
|
276
|
+
end.flatten.uniq
|
|
277
|
+
sorted_files = files.sort { |a,b| (b =~ %r{/support/} || -1) <=> (a =~ %r{/support/} || -1) }.reject{|f| f =~ /^http/}
|
|
278
|
+
env_files = sorted_files.select {|f| f =~ %r{/support/env.rb} }
|
|
279
|
+
files = env_files + sorted_files.reject {|f| f =~ %r{/support/env.rb} }
|
|
280
|
+
remove_excluded_files_from(files)
|
|
281
|
+
files.reject! {|f| f =~ %r{/support/env.rb} } if @options[:dry_run]
|
|
282
|
+
files
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def feature_files
|
|
286
|
+
potential_feature_files = @paths.map do |path|
|
|
287
|
+
path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
|
|
288
|
+
path = path.chomp('/')
|
|
289
|
+
File.directory?(path) ? Dir["#{path}/**/*.feature"] : path
|
|
290
|
+
end.flatten.uniq
|
|
291
|
+
remove_excluded_files_from(potential_feature_files)
|
|
292
|
+
potential_feature_files
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
protected
|
|
296
|
+
|
|
297
|
+
def arrange_formats
|
|
298
|
+
@options[:formats] << ['pretty', @out_stream] if @options[:formats].empty?
|
|
299
|
+
@options[:formats] = @options[:formats].sort_by{|f| f[1] == @out_stream ? -1 : 1}
|
|
300
|
+
if @options[:formats].length > 1 && @options[:formats][1][1] == @out_stream
|
|
301
|
+
raise "All but one formatter must use --out, only one can print to STDOUT"
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
def remove_excluded_files_from(files)
|
|
306
|
+
files.reject! {|path| @options[:excludes].detect {|pattern| path =~ pattern } }
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
def feature_dirs
|
|
310
|
+
@paths.map { |f| File.directory?(f) ? f : File.dirname(f) }.uniq
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
def constantize(camel_cased_word)
|
|
314
|
+
begin
|
|
315
|
+
names = camel_cased_word.split('::')
|
|
316
|
+
names.shift if names.empty? || names.first.empty?
|
|
317
|
+
|
|
318
|
+
constant = Object
|
|
319
|
+
names.each do |name|
|
|
320
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
|
321
|
+
end
|
|
322
|
+
constant
|
|
323
|
+
rescue NameError
|
|
324
|
+
require underscore(camel_cased_word)
|
|
325
|
+
retry
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# Snagged from active_support
|
|
330
|
+
def underscore(camel_cased_word)
|
|
331
|
+
camel_cased_word.to_s.gsub(/::/, '/').
|
|
332
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
|
333
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
|
334
|
+
tr("-", "_").
|
|
335
|
+
downcase
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
def expand_profiles_into_args
|
|
339
|
+
while (profile_index = @args.index(PROFILE_SHORT_FLAG) || @args.index(PROFILE_LONG_FLAG)) do
|
|
340
|
+
@args.delete_at(profile_index)
|
|
341
|
+
@args[profile_index] = args_from_profile(@args[profile_index])
|
|
342
|
+
@args.flatten!
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
def args_from_profile(profile)
|
|
347
|
+
unless cucumber_yml.has_key?(profile)
|
|
348
|
+
raise(<<-END_OF_ERROR)
|
|
349
|
+
Could not find profile: '#{profile}'
|
|
350
|
+
|
|
351
|
+
Defined profiles in cucumber.yml:
|
|
352
|
+
* #{cucumber_yml.keys.join("\n * ")}
|
|
353
|
+
END_OF_ERROR
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
args_from_yml = cucumber_yml[profile] || ''
|
|
357
|
+
|
|
358
|
+
case(args_from_yml)
|
|
359
|
+
when String
|
|
360
|
+
raise "The '#{profile}' profile in cucumber.yml was blank. Please define the command line arguments for the '#{profile}' profile in cucumber.yml.\n" if args_from_yml =~ /^\s*$/
|
|
361
|
+
args_from_yml = args_from_yml.split(' ')
|
|
362
|
+
when Array
|
|
363
|
+
raise "The '#{profile}' profile in cucumber.yml was empty. Please define the command line arguments for the '#{profile}' profile in cucumber.yml.\n" if args_from_yml.empty?
|
|
364
|
+
else
|
|
365
|
+
raise "The '#{profile}' profile in cucumber.yml was a #{args_from_yml.class}. It must be a String or Array"
|
|
366
|
+
end
|
|
367
|
+
args_from_yml
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def cucumber_yml
|
|
371
|
+
return @cucumber_yml if @cucumber_yml
|
|
372
|
+
unless File.exist?('cucumber.yml')
|
|
373
|
+
raise(YmlLoadError,"cucumber.yml was not found. Please refer to cucumber's documentation on defining profiles in cucumber.yml. You must define a 'default' profile to use the cucumber command without any arguments.\nType 'cucumber --help' for usage.\n")
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
require 'yaml'
|
|
377
|
+
begin
|
|
378
|
+
@cucumber_yml = YAML::load(IO.read('cucumber.yml'))
|
|
379
|
+
rescue StandardError => e
|
|
380
|
+
raise(YmlLoadError,"cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
if @cucumber_yml.nil? || !@cucumber_yml.is_a?(Hash)
|
|
384
|
+
raise(YmlLoadError,"cucumber.yml was found, but was blank or malformed. Please refer to cucumber's documentation on correct profile usage.\n")
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
return @cucumber_yml
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
# TODO: Move to Language
|
|
391
|
+
def list_keywords_and_exit(lang)
|
|
392
|
+
unless Cucumber::LANGUAGES[lang]
|
|
393
|
+
raise("No language with key #{lang}")
|
|
394
|
+
end
|
|
395
|
+
LanguageHelpFormatter.list_keywords(@out_stream, lang)
|
|
396
|
+
Kernel.exit
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
def list_languages_and_exit
|
|
400
|
+
LanguageHelpFormatter.list_languages(@out_stream)
|
|
401
|
+
Kernel.exit
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
def parse_drb
|
|
405
|
+
@drb = @args.delete(DRB_FLAG) ? true : false
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
def default_options
|
|
409
|
+
{
|
|
410
|
+
:strict => false,
|
|
411
|
+
:require => nil,
|
|
412
|
+
:lang => nil,
|
|
413
|
+
:dry_run => false,
|
|
414
|
+
:formats => [],
|
|
415
|
+
:excludes => [],
|
|
416
|
+
:include_tags => [],
|
|
417
|
+
:exclude_tags => [],
|
|
418
|
+
:name_regexps => [],
|
|
419
|
+
:diff_enabled => true
|
|
420
|
+
}
|
|
421
|
+
end
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
end
|
|
425
|
+
end
|