dwaite-cucumber 0.3.101
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 +1067 -0
- data/License.txt +22 -0
- data/Manifest.txt +453 -0
- data/README.txt +4 -0
- data/Rakefile +9 -0
- data/bin/cucumber +17 -0
- data/config/hoe.rb +78 -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 +32 -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/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/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/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 +17 -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/uz/Rakefile +6 -0
- data/examples/i18n/uz/features/addition.feature +10 -0
- data/examples/i18n/uz/features/consecutive_calculations.feature +17 -0
- data/examples/i18n/uz/features/division.feature +17 -0
- data/examples/i18n/uz/features/step_definitons/calculator_steps.rb +19 -0
- data/examples/i18n/uz/features/support/env.rb +6 -0
- data/examples/i18n/uz/features/support/world.rb +8 -0
- data/examples/i18n/uz/lib/calculator.rb +24 -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/python/features/fibonacci.feature +19 -0
- data/examples/python/features/step_definitions/fib_steps.py +3 -0
- data/examples/python/features/step_definitions/fib_steps.rb +7 -0
- data/examples/python/features/support/env.rb +21 -0
- data/examples/python/lib/fib.py +7 -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 +93 -0
- data/examples/self_test/features/support/env.rb +24 -0
- data/examples/self_test/features/tags_sample.feature +17 -0
- data/examples/self_test/features/tons_of_cukes.feature +52 -0
- data/examples/self_test/features/transform_sample.feature +10 -0
- data/examples/self_test/features/undefined_multiline_args.feature +12 -0
- data/examples/self_test/list-of-features.txt +1 -0
- data/examples/sinatra/README.textile +13 -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 +32 -0
- data/examples/sinatra/views/add.erb +5 -0
- data/examples/sinatra/views/layout.erb +8 -0
- data/examples/steps_library/features/step_definitions/steps_lib1.rb +8 -0
- data/examples/steps_library/features/step_definitions/steps_lib2.rb +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 +81 -0
- data/examples/tickets/features/table_diffing.feature +13 -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 +26 -0
- data/examples/watir/features/support/env.rb +32 -0
- data/features/background.feature +311 -0
- data/features/bug_371.feature +32 -0
- data/features/cucumber_cli.feature +667 -0
- data/features/cucumber_cli_diff_disabled.feature +54 -0
- data/features/cucumber_cli_outlines.feature +109 -0
- data/features/custom_formatter.feature +11 -0
- data/features/drb_server_integration.feature +173 -0
- data/features/exception_in_after_block.feature +102 -0
- data/features/exception_in_after_step_block.feature +104 -0
- data/features/exception_in_before_block.feature +47 -0
- data/features/exclude_files.feature +20 -0
- data/features/expand.feature +49 -0
- data/features/html_formatter/a.html +183 -0
- data/features/html_formatter.feature +7 -0
- data/features/junit_formatter.feature +89 -0
- data/features/language_from_header.feature +30 -0
- data/features/multiline_names.feature +43 -0
- data/features/post_configuration_hook.feature +37 -0
- data/features/profiles.feature +112 -0
- data/features/rake_task.feature +178 -0
- data/features/report_called_undefined_steps.feature +35 -0
- data/features/snippet.feature +22 -0
- data/features/step_definitions/cucumber_steps.rb +154 -0
- data/features/step_definitions/extra_steps.rb +2 -0
- data/features/steps_formatter.feature +25 -0
- data/features/support/env.rb +139 -0
- data/features/table_diffing.feature +45 -0
- data/features/transform.feature +24 -0
- data/features/unicode_table.feature +35 -0
- data/features/usage.feature +132 -0
- data/features/work_in_progress.feature +158 -0
- data/gem_tasks/contributors.rake +12 -0
- data/gem_tasks/deployment.rake +11 -0
- data/gem_tasks/environment.rake +7 -0
- data/gem_tasks/features.rake +11 -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/sdoc.rake +7 -0
- data/lib/README.rdoc +12 -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/ast/background.rb +63 -0
- data/lib/cucumber/ast/comment.rb +31 -0
- data/lib/cucumber/ast/examples.rb +32 -0
- data/lib/cucumber/ast/feature.rb +81 -0
- data/lib/cucumber/ast/feature_element.rb +61 -0
- data/lib/cucumber/ast/features.rb +40 -0
- data/lib/cucumber/ast/outline_table.rb +146 -0
- data/lib/cucumber/ast/py_string.rb +57 -0
- data/lib/cucumber/ast/scenario.rb +108 -0
- data/lib/cucumber/ast/scenario_outline.rb +96 -0
- data/lib/cucumber/ast/step.rb +116 -0
- data/lib/cucumber/ast/step_collection.rb +76 -0
- data/lib/cucumber/ast/step_invocation.rb +166 -0
- data/lib/cucumber/ast/table.rb +626 -0
- data/lib/cucumber/ast/tags.rb +44 -0
- data/lib/cucumber/ast/visitor.rb +115 -0
- data/lib/cucumber/ast.rb +29 -0
- data/lib/cucumber/broadcaster.rb +13 -0
- data/lib/cucumber/cli/configuration.rb +190 -0
- data/lib/cucumber/cli/drb_client.rb +26 -0
- data/lib/cucumber/cli/language_help_formatter.rb +61 -0
- data/lib/cucumber/cli/main.rb +116 -0
- data/lib/cucumber/cli/options.rb +394 -0
- data/lib/cucumber/cli/profile_loader.rb +70 -0
- data/lib/cucumber/constantize.rb +28 -0
- data/lib/cucumber/core_ext/instance_exec.rb +93 -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 +54 -0
- data/lib/cucumber/filter.rb +52 -0
- data/lib/cucumber/formatter/ansicolor.rb +143 -0
- data/lib/cucumber/formatter/color_io.rb +23 -0
- data/lib/cucumber/formatter/console.rb +185 -0
- data/lib/cucumber/formatter/cucumber.css +132 -0
- data/lib/cucumber/formatter/cucumber.sass +139 -0
- data/lib/cucumber/formatter/duration.rb +13 -0
- data/lib/cucumber/formatter/html.rb +261 -0
- data/lib/cucumber/formatter/junit.rb +121 -0
- data/lib/cucumber/formatter/ordered_xml_markup.rb +24 -0
- data/lib/cucumber/formatter/pdf.rb +217 -0
- data/lib/cucumber/formatter/pretty.rb +222 -0
- data/lib/cucumber/formatter/profile.rb +78 -0
- data/lib/cucumber/formatter/progress.rb +67 -0
- data/lib/cucumber/formatter/rerun.rb +46 -0
- data/lib/cucumber/formatter/steps.rb +50 -0
- data/lib/cucumber/formatter/tag_cloud.rb +29 -0
- data/lib/cucumber/formatter/unicode.rb +35 -0
- data/lib/cucumber/formatter/usage.rb +86 -0
- data/lib/cucumber/formatters/unicode.rb +7 -0
- data/lib/cucumber/language_support/language_methods.rb +75 -0
- data/lib/cucumber/language_support/step_definition_methods.rb +46 -0
- data/lib/cucumber/language_support.rb +30 -0
- data/lib/cucumber/languages.yml +561 -0
- data/lib/cucumber/parser/feature.rb +1838 -0
- data/lib/cucumber/parser/feature.tt +351 -0
- data/lib/cucumber/parser/i18n.tt +42 -0
- data/lib/cucumber/parser/natural_language.rb +72 -0
- data/lib/cucumber/parser/table.rb +417 -0
- data/lib/cucumber/parser/table.tt +71 -0
- data/lib/cucumber/parser/treetop_ext.rb +53 -0
- data/lib/cucumber/parser.rb +6 -0
- data/lib/cucumber/platform.rb +27 -0
- data/lib/cucumber/py_support/py_dsl.py +8 -0
- data/lib/cucumber/py_support/py_language.py +2 -0
- data/lib/cucumber/py_support/py_language.rb +68 -0
- data/lib/cucumber/rails/rspec.rb +10 -0
- data/lib/cucumber/rails/world.rb +100 -0
- data/lib/cucumber/rake/task.rb +241 -0
- data/lib/cucumber/rb_support/rb_dsl.rb +100 -0
- data/lib/cucumber/rb_support/rb_hook.rb +18 -0
- data/lib/cucumber/rb_support/rb_language.rb +153 -0
- data/lib/cucumber/rb_support/rb_step_definition.rb +60 -0
- data/lib/cucumber/rb_support/rb_world.rb +93 -0
- data/lib/cucumber/rspec_neuter.rb +23 -0
- data/lib/cucumber/step_match.rb +61 -0
- data/lib/cucumber/step_mother.rb +307 -0
- data/lib/cucumber/version.rb +10 -0
- data/lib/cucumber/webrat/element_locator.rb +87 -0
- data/lib/cucumber/webrat/table_locator.rb +1 -0
- data/lib/cucumber.rb +10 -0
- data/rails_generators/cucumber/USAGE +11 -0
- data/rails_generators/cucumber/cucumber_generator.rb +70 -0
- data/rails_generators/cucumber/templates/cucumber +9 -0
- data/rails_generators/cucumber/templates/cucumber.rake +36 -0
- data/rails_generators/cucumber/templates/cucumber_environment.rb +26 -0
- data/rails_generators/cucumber/templates/env.rb +27 -0
- data/rails_generators/cucumber/templates/paths.rb +27 -0
- data/rails_generators/cucumber/templates/spork_env.rb +35 -0
- data/rails_generators/cucumber/templates/webrat_steps.rb +236 -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 +14 -0
- data/spec/cucumber/ast/background_spec.rb +60 -0
- data/spec/cucumber/ast/feature_element_spec.rb +40 -0
- data/spec/cucumber/ast/feature_factory.rb +62 -0
- data/spec/cucumber/ast/feature_spec.rb +44 -0
- data/spec/cucumber/ast/py_string_spec.rb +51 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +72 -0
- data/spec/cucumber/ast/scenario_spec.rb +43 -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 +394 -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 +77 -0
- data/spec/cucumber/cli/main_spec.rb +172 -0
- data/spec/cucumber/cli/options_spec.rb +331 -0
- data/spec/cucumber/cli/profile_loader_spec.rb +10 -0
- data/spec/cucumber/core_ext/proc_spec.rb +68 -0
- data/spec/cucumber/core_ext/string_spec.rb +43 -0
- data/spec/cucumber/formatter/ansicolor_spec.rb +31 -0
- data/spec/cucumber/formatter/color_io_spec.rb +27 -0
- data/spec/cucumber/formatter/duration_spec.rb +22 -0
- data/spec/cucumber/formatter/html_spec.rb +18 -0
- data/spec/cucumber/formatter/progress_spec.rb +33 -0
- data/spec/cucumber/parser/feature_parser_spec.rb +396 -0
- data/spec/cucumber/parser/table_parser_spec.rb +52 -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 +16 -0
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +123 -0
- data/spec/cucumber/sell_cucumbers.feature +19 -0
- data/spec/cucumber/step_mother_spec.rb +282 -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 +23 -0
- data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
- data/spec/cucumber/world/pending_spec.rb +46 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +18 -0
- metadata +561 -0
@@ -0,0 +1,394 @@
|
|
1
|
+
require 'cucumber/cli/profile_loader'
|
2
|
+
module Cucumber
|
3
|
+
module Cli
|
4
|
+
|
5
|
+
class Options
|
6
|
+
BUILTIN_FORMATS = {
|
7
|
+
'html' => ['Cucumber::Formatter::Html', 'Generates a nice looking HTML report.'],
|
8
|
+
'pretty' => ['Cucumber::Formatter::Pretty', 'Prints the feature as is - in colours.'],
|
9
|
+
'pdf' => ['Cucumber::Formatter::Pdf', "Generates a PDF report. You need to have the\n" +
|
10
|
+
"#{' ' * 51}prawn gem installed. Will pick up logo from\n" +
|
11
|
+
"#{' ' * 51}features/support/logo.png if present."],
|
12
|
+
'profile' => ['Cucumber::Formatter::Profile', 'Prints the 10 slowest steps at the end.'],
|
13
|
+
'progress' => ['Cucumber::Formatter::Progress', 'Prints one character per scenario.'],
|
14
|
+
'rerun' => ['Cucumber::Formatter::Rerun', 'Prints failing files with line numbers.'],
|
15
|
+
'usage' => ['Cucumber::Formatter::Usage', 'Prints where step definitions are used.'],
|
16
|
+
'junit' => ['Cucumber::Formatter::Junit', 'Generates a report similar to Ant+JUnit.'],
|
17
|
+
'tag_cloud' => ['Cucumber::Formatter::TagCloud', 'Prints a tag cloud of tag usage.'],
|
18
|
+
'steps' => ['Cucumber::Formatter::Steps', 'Prints location of step definitions.']
|
19
|
+
}
|
20
|
+
max = BUILTIN_FORMATS.keys.map{|s| s.length}.max
|
21
|
+
FORMAT_HELP = (BUILTIN_FORMATS.keys.sort.map do |key|
|
22
|
+
" #{key}#{' ' * (max - key.length)} : #{BUILTIN_FORMATS[key][1]}"
|
23
|
+
end) + ["Use --format rerun --out features.txt to rerun failing",
|
24
|
+
"failing features in a new run with cucumber @features.txt.",
|
25
|
+
"FORMAT can also be the fully qualified class name of",
|
26
|
+
"your own custom formatter. If the class isn't loaded,",
|
27
|
+
"Cucumber will attempt to require a file with a relative",
|
28
|
+
"file name that is the underscore name of the class name.",
|
29
|
+
"Example: --format Foo::BarZap -> Cucumber will look for",
|
30
|
+
"foo/bar_zap.rb. You can place the file with this relative",
|
31
|
+
"path underneath your features/support directory or anywhere",
|
32
|
+
"on Ruby's LOAD_PATH, for example in a Ruby gem."
|
33
|
+
]
|
34
|
+
DRB_FLAG = '--drb'
|
35
|
+
PROFILE_SHORT_FLAG = '-p'
|
36
|
+
NO_PROFILE_SHORT_FLAG = '-P'
|
37
|
+
PROFILE_LONG_FLAG = '--profile'
|
38
|
+
NO_PROFILE_LONG_FLAG = '--no-profile'
|
39
|
+
|
40
|
+
|
41
|
+
def self.parse(args, out_stream, error_stream, options = {})
|
42
|
+
new(out_stream, error_stream, options).parse!(args)
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize(out_stream = STDOUT, error_stream = STDERR, options = {})
|
46
|
+
@out_stream = out_stream
|
47
|
+
@error_stream = error_stream
|
48
|
+
|
49
|
+
@default_profile = options[:default_profile]
|
50
|
+
@skip_profile_information = options[:skip_profile_information]
|
51
|
+
@profiles = []
|
52
|
+
@overridden_paths = []
|
53
|
+
@options = default_options
|
54
|
+
end
|
55
|
+
|
56
|
+
def [](key)
|
57
|
+
@options[key]
|
58
|
+
end
|
59
|
+
|
60
|
+
def []=(key, value)
|
61
|
+
@options[key] = value
|
62
|
+
end
|
63
|
+
|
64
|
+
def expanded_args_without_drb
|
65
|
+
return @expanded_args_without_drb if @expanded_args_without_drb
|
66
|
+
@expanded_args_without_drb = (
|
67
|
+
previous_flag_was_profile = false
|
68
|
+
@expanded_args.reject do |arg|
|
69
|
+
if previous_flag_was_profile
|
70
|
+
previous_flag_was_profile = false
|
71
|
+
next true
|
72
|
+
end
|
73
|
+
if [PROFILE_SHORT_FLAG, PROFILE_LONG_FLAG].include?(arg)
|
74
|
+
previous_flag_was_profile = true
|
75
|
+
next true
|
76
|
+
end
|
77
|
+
arg == DRB_FLAG || @overridden_paths.include?(arg)
|
78
|
+
end
|
79
|
+
)
|
80
|
+
|
81
|
+
@expanded_args_without_drb.push("--no-profile") unless @expanded_args_without_drb.include?(NO_PROFILE_LONG_FLAG) || @expanded_args_without_drb.include?(NO_PROFILE_SHORT_FLAG)
|
82
|
+
@expanded_args_without_drb
|
83
|
+
end
|
84
|
+
|
85
|
+
def parse!(args)
|
86
|
+
@args = args
|
87
|
+
@expanded_args = @args.dup
|
88
|
+
|
89
|
+
@args.extend(::OptionParser::Arguable)
|
90
|
+
|
91
|
+
@args.options do |opts|
|
92
|
+
opts.banner = ["Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+", "",
|
93
|
+
"Examples:",
|
94
|
+
"cucumber examples/i18n/en/features",
|
95
|
+
"cucumber @features.txt (See --format rerun)",
|
96
|
+
"cucumber --language it examples/i18n/it/features/somma.feature:6:98:113",
|
97
|
+
"cucumber -s -i http://rubyurl.com/eeCl", "", "",
|
98
|
+
].join("\n")
|
99
|
+
opts.on("-r LIBRARY|DIR", "--require LIBRARY|DIR",
|
100
|
+
"Require files before executing the features. If this",
|
101
|
+
"option is not specified, all *.rb files that are",
|
102
|
+
"siblings or below the features will be loaded auto-",
|
103
|
+
"matically. Automatic loading is disabled when this",
|
104
|
+
"option is specified, and all loading becomes explicit.",
|
105
|
+
"Files under directories named \"support\" are always",
|
106
|
+
"loaded first.",
|
107
|
+
"This option can be specified multiple times.") do |v|
|
108
|
+
@options[:require] << v
|
109
|
+
end
|
110
|
+
opts.on("-l LANG", "--language LANG",
|
111
|
+
"Specify language for features (Default: #{@options[:lang]})",
|
112
|
+
%{Run with "--language help" to see all languages},
|
113
|
+
%{Run with "--language LANG help" to list keywords for LANG}) do |v|
|
114
|
+
if v == 'help'
|
115
|
+
list_languages_and_exit
|
116
|
+
elsif args==['help'] # I think this conditional is just cruft and can be removed
|
117
|
+
list_keywords_and_exit(v)
|
118
|
+
else
|
119
|
+
@options[:lang] = v
|
120
|
+
end
|
121
|
+
end
|
122
|
+
opts.on("-f FORMAT", "--format FORMAT",
|
123
|
+
"How to format features (Default: pretty). Available formats:",
|
124
|
+
*FORMAT_HELP) do |v|
|
125
|
+
@options[:formats] << [v, @out_stream]
|
126
|
+
end
|
127
|
+
opts.on("-o", "--out [FILE|DIR]",
|
128
|
+
"Write output to a file/directory instead of STDOUT. This option",
|
129
|
+
"applies to the previously specified --format, or the",
|
130
|
+
"default format if no format is specified. Check the specific",
|
131
|
+
"formatter's docs to see whether to pass a file or a dir.") do |v|
|
132
|
+
@options[:formats] << ['pretty', nil] if @options[:formats].empty?
|
133
|
+
@options[:formats][-1][1] = v
|
134
|
+
end
|
135
|
+
opts.on("-t TAGS", "--tags TAGS",
|
136
|
+
"Only execute the features or scenarios with the specified tags.",
|
137
|
+
"TAGS must be comma-separated without spaces. They can be",
|
138
|
+
"specified with or without the @ prefix. Example: --tags dev\n",
|
139
|
+
"Negative tags: Prefix tags with ~ to exclude features or scenarios",
|
140
|
+
"having that tag.\n",
|
141
|
+
"Limit WIP: Positive tags can be given a threshold to limit the",
|
142
|
+
"number of occurrences. Example: --tags qa:3 will fail if there",
|
143
|
+
"are more than 3 occurrences of the @qa tag.") do |v|
|
144
|
+
include_tags, exclude_tags = *parse_tags(v)
|
145
|
+
@options[:include_tags].merge!(include_tags)
|
146
|
+
@options[:exclude_tags].merge!(exclude_tags)
|
147
|
+
end
|
148
|
+
opts.on("-n NAME", "--name NAME",
|
149
|
+
"Only execute the feature elements which match part of the given name.",
|
150
|
+
"If this option is given more than once, it will match against all the",
|
151
|
+
"given names.") do |v|
|
152
|
+
@options[:name_regexps] << /#{v}/
|
153
|
+
end
|
154
|
+
opts.on("-e", "--exclude PATTERN", "Don't run feature files or require ruby files matching PATTERN") do |v|
|
155
|
+
@options[:excludes] << Regexp.new(v)
|
156
|
+
end
|
157
|
+
opts.on(PROFILE_SHORT_FLAG, "#{PROFILE_LONG_FLAG} PROFILE",
|
158
|
+
"Pull commandline arguments from cucumber.yml which can be defined as",
|
159
|
+
"strings or arrays. When a 'default' profile is defined and no profile",
|
160
|
+
"is specified it is always used. (Unless disabled, see -P below.)",
|
161
|
+
"When feature files are defined in a profile and on the command line",
|
162
|
+
"then only the ones from the command line are used.") do |v|
|
163
|
+
@profiles << v
|
164
|
+
end
|
165
|
+
opts.on(NO_PROFILE_SHORT_FLAG, NO_PROFILE_LONG_FLAG,
|
166
|
+
"Disables all profile laoding to avoid using the 'default' profile.") do |v|
|
167
|
+
@disable_profile_loading = true
|
168
|
+
end
|
169
|
+
opts.on("-c", "--[no-]color",
|
170
|
+
"Whether or not to use ANSI color in the output. Cucumber decides",
|
171
|
+
"based on your platform and the output destination if not specified.") do |v|
|
172
|
+
Term::ANSIColor.coloring = v
|
173
|
+
end
|
174
|
+
opts.on("-d", "--dry-run", "Invokes formatters without executing the steps.",
|
175
|
+
"This also omits the loading of your support/env.rb file if it exists.",
|
176
|
+
"Implies --quiet.") do
|
177
|
+
@options[:dry_run] = true
|
178
|
+
@quiet = true
|
179
|
+
end
|
180
|
+
opts.on("-a", "--autoformat DIRECTORY",
|
181
|
+
"Reformats (pretty prints) feature files and write them to DIRECTORY.",
|
182
|
+
"Be careful if you choose to overwrite the originals.",
|
183
|
+
"Implies --dry-run --formatter pretty.") do |directory|
|
184
|
+
@options[:autoformat] = directory
|
185
|
+
Term::ANSIColor.coloring = false
|
186
|
+
@options[:dry_run] = true
|
187
|
+
@quiet = true
|
188
|
+
end
|
189
|
+
|
190
|
+
opts.on("-m", "--no-multiline",
|
191
|
+
"Don't print multiline strings and tables under steps.") do
|
192
|
+
@options[:no_multiline] = true
|
193
|
+
end
|
194
|
+
opts.on("-s", "--no-source",
|
195
|
+
"Don't print the file and line of the step definition with the steps.") do
|
196
|
+
@options[:source] = false
|
197
|
+
end
|
198
|
+
opts.on("-i", "--no-snippets", "Don't print snippets for pending steps.") do
|
199
|
+
@options[:snippets] = false
|
200
|
+
end
|
201
|
+
opts.on("-q", "--quiet", "Alias for --no-snippets --no-source.") do
|
202
|
+
@quiet = true
|
203
|
+
end
|
204
|
+
opts.on("-b", "--backtrace", "Show full backtrace for all errors.") do
|
205
|
+
Cucumber.use_full_backtrace = true
|
206
|
+
end
|
207
|
+
opts.on("-S", "--strict", "Fail if there are any undefined steps.") do
|
208
|
+
@options[:strict] = true
|
209
|
+
end
|
210
|
+
opts.on("-w", "--wip", "Fail if there are any passing scenarios.") do
|
211
|
+
@options[:wip] = true
|
212
|
+
end
|
213
|
+
opts.on("-v", "--verbose", "Show the files and features loaded.") do
|
214
|
+
@options[:verbose] = true
|
215
|
+
end
|
216
|
+
opts.on("-g", "--guess", "Guess best match for Ambiguous steps.") do
|
217
|
+
@options[:guess] = true
|
218
|
+
end
|
219
|
+
opts.on("-x", "--expand", "Expand Scenario Outline Tables in output.") do
|
220
|
+
@options[:expand] = true
|
221
|
+
end
|
222
|
+
opts.on("--no-diff", "Disable diff output on failing expectations.") do
|
223
|
+
@options[:diff_enabled] = false
|
224
|
+
end
|
225
|
+
opts.on(DRB_FLAG, "Run features against a DRb server. (i.e. with the spork gem)") do
|
226
|
+
@options[:drb] = true
|
227
|
+
end
|
228
|
+
opts.on("--port PORT", "Specify DRb port. Ignored without --drb") do |port|
|
229
|
+
@options[:drb_port] = port
|
230
|
+
end
|
231
|
+
opts.on_tail("--version", "Show version.") do
|
232
|
+
@out_stream.puts VERSION::STRING
|
233
|
+
Kernel.exit
|
234
|
+
end
|
235
|
+
opts.on_tail("-h", "--help", "You're looking at it.") do
|
236
|
+
@out_stream.puts opts.help
|
237
|
+
Kernel.exit
|
238
|
+
end
|
239
|
+
end.parse!
|
240
|
+
|
241
|
+
if @quiet
|
242
|
+
@options[:snippets] = @options[:source] = false
|
243
|
+
else
|
244
|
+
@options[:snippets] = true if @options[:snippets].nil?
|
245
|
+
@options[:source] = true if @options[:source].nil?
|
246
|
+
end
|
247
|
+
|
248
|
+
extract_environment_variables
|
249
|
+
@options[:paths] = @args.dup #whatver is left over
|
250
|
+
|
251
|
+
merge_profiles
|
252
|
+
print_profile_information
|
253
|
+
|
254
|
+
self
|
255
|
+
end
|
256
|
+
|
257
|
+
protected
|
258
|
+
|
259
|
+
attr_reader :options, :profiles, :expanded_args
|
260
|
+
protected :options, :profiles, :expanded_args
|
261
|
+
|
262
|
+
def non_stdout_formats
|
263
|
+
@options[:formats].select {|format, output| output != @out_stream }
|
264
|
+
end
|
265
|
+
|
266
|
+
private
|
267
|
+
|
268
|
+
def extract_environment_variables
|
269
|
+
@args.delete_if do |arg|
|
270
|
+
if arg =~ /^(\w+)=(.*)$/
|
271
|
+
@options[:env_vars][$1] = $2
|
272
|
+
true
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
def parse_tags(tag_string)
|
278
|
+
tag_names = tag_string.split(",")
|
279
|
+
excludes, includes = tag_names.partition{|tag| tag =~ /^~/}
|
280
|
+
excludes = excludes.map{|tag| tag[1..-1]}
|
281
|
+
|
282
|
+
# Strip @
|
283
|
+
includes = includes.map{|tag| Ast::Tags.strip_prefix(tag)}
|
284
|
+
excludes = excludes.map{|tag| Ast::Tags.strip_prefix(tag)}
|
285
|
+
[parse_tag_limits(includes), parse_tag_limits(excludes)]
|
286
|
+
end
|
287
|
+
|
288
|
+
def parse_tag_limits(includes)
|
289
|
+
dict = {}
|
290
|
+
includes.each do |tag|
|
291
|
+
tag, limit = tag.split(':')
|
292
|
+
dict[tag] = limit.nil? ? limit : limit.to_i
|
293
|
+
end
|
294
|
+
dict
|
295
|
+
end
|
296
|
+
|
297
|
+
def disable_profile_loading?
|
298
|
+
@disable_profile_loading
|
299
|
+
end
|
300
|
+
|
301
|
+
def merge_profiles
|
302
|
+
if @disable_profile_loading
|
303
|
+
@out_stream.puts "Disabling profiles..."
|
304
|
+
return
|
305
|
+
end
|
306
|
+
|
307
|
+
@profiles << @default_profile if default_profile_should_be_used?
|
308
|
+
|
309
|
+
@profiles.each do |profile|
|
310
|
+
profile_args = profile_loader.args_from(profile)
|
311
|
+
reverse_merge(
|
312
|
+
Options.parse(profile_args, @out_stream, @error_stream, :skip_profile_information => true)
|
313
|
+
)
|
314
|
+
end
|
315
|
+
|
316
|
+
end
|
317
|
+
|
318
|
+
def default_profile_should_be_used?
|
319
|
+
@profiles.empty? &&
|
320
|
+
profile_loader.cucumber_yml_defined? &&
|
321
|
+
profile_loader.has_profile?(@default_profile)
|
322
|
+
end
|
323
|
+
|
324
|
+
def profile_loader
|
325
|
+
@profile_loader ||= ProfileLoader.new
|
326
|
+
end
|
327
|
+
|
328
|
+
def reverse_merge(other_options)
|
329
|
+
@options = other_options.options.merge(@options)
|
330
|
+
@options[:require] += other_options[:require]
|
331
|
+
@options[:include_tags].merge! other_options[:include_tags]
|
332
|
+
@options[:exclude_tags].merge! other_options[:exclude_tags]
|
333
|
+
@options[:env_vars] = other_options[:env_vars].merge(@options[:env_vars])
|
334
|
+
if @options[:paths].empty?
|
335
|
+
@options[:paths] = other_options[:paths]
|
336
|
+
else
|
337
|
+
@overridden_paths += (other_options[:paths] - @options[:paths])
|
338
|
+
end
|
339
|
+
@options[:source] &= other_options[:source]
|
340
|
+
@options[:snippets] &= other_options[:snippets]
|
341
|
+
|
342
|
+
@profiles += other_options.profiles
|
343
|
+
@expanded_args += other_options.expanded_args
|
344
|
+
|
345
|
+
if @options[:formats].empty?
|
346
|
+
@options[:formats] = other_options[:formats]
|
347
|
+
else
|
348
|
+
@options[:formats] += other_options.non_stdout_formats
|
349
|
+
end
|
350
|
+
|
351
|
+
self
|
352
|
+
end
|
353
|
+
|
354
|
+
# TODO: Move to Language
|
355
|
+
def list_keywords_and_exit(lang)
|
356
|
+
unless Cucumber::LANGUAGES[lang]
|
357
|
+
raise("No language with key #{lang}")
|
358
|
+
end
|
359
|
+
LanguageHelpFormatter.list_keywords(@out_stream, lang)
|
360
|
+
Kernel.exit
|
361
|
+
end
|
362
|
+
|
363
|
+
def list_languages_and_exit
|
364
|
+
LanguageHelpFormatter.list_languages(@out_stream)
|
365
|
+
Kernel.exit
|
366
|
+
end
|
367
|
+
|
368
|
+
def print_profile_information
|
369
|
+
return if @skip_profile_information || @profiles.empty?
|
370
|
+
profiles_sentence = ''
|
371
|
+
profiles_sentence = @profiles.size == 1 ? @profiles.first :
|
372
|
+
"#{@profiles[0...-1].join(', ')} and #{@profiles.last}"
|
373
|
+
|
374
|
+
@out_stream.puts "Using the #{profiles_sentence} profile#{'s' if @profiles.size> 1}..."
|
375
|
+
end
|
376
|
+
|
377
|
+
def default_options
|
378
|
+
{
|
379
|
+
:strict => false,
|
380
|
+
:require => [],
|
381
|
+
:dry_run => false,
|
382
|
+
:formats => [],
|
383
|
+
:excludes => [],
|
384
|
+
:include_tags => {},
|
385
|
+
:exclude_tags => {},
|
386
|
+
:name_regexps => [],
|
387
|
+
:env_vars => {},
|
388
|
+
:diff_enabled => true
|
389
|
+
}
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
end
|
394
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Cli
|
3
|
+
|
4
|
+
class ProfileLoader
|
5
|
+
|
6
|
+
def args_from(profile)
|
7
|
+
unless cucumber_yml.has_key?(profile)
|
8
|
+
raise(ProfileNotFound, <<-END_OF_ERROR)
|
9
|
+
Could not find profile: '#{profile}'
|
10
|
+
|
11
|
+
Defined profiles in cucumber.yml:
|
12
|
+
* #{cucumber_yml.keys.join("\n * ")}
|
13
|
+
END_OF_ERROR
|
14
|
+
end
|
15
|
+
|
16
|
+
args_from_yml = cucumber_yml[profile] || ''
|
17
|
+
|
18
|
+
case(args_from_yml)
|
19
|
+
when String
|
20
|
+
raise YmlLoadError, "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*$/
|
21
|
+
args_from_yml = args_from_yml.split(' ')
|
22
|
+
when Array
|
23
|
+
raise YmlLoadError, "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?
|
24
|
+
else
|
25
|
+
raise YmlLoadError, "The '#{profile}' profile in cucumber.yml was a #{args_from_yml.class}. It must be a String or Array"
|
26
|
+
end
|
27
|
+
args_from_yml
|
28
|
+
end
|
29
|
+
|
30
|
+
def has_profile?(profile)
|
31
|
+
cucumber_yml.has_key?(profile)
|
32
|
+
end
|
33
|
+
|
34
|
+
def cucumber_yml_defined?
|
35
|
+
@defined ||= File.exist?('cucumber.yml')
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def cucumber_yml
|
41
|
+
return @cucumber_yml if @cucumber_yml
|
42
|
+
unless cucumber_yml_defined?
|
43
|
+
raise(ProfilesNotDefinedError,"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")
|
44
|
+
end
|
45
|
+
|
46
|
+
require 'erb'
|
47
|
+
require 'yaml'
|
48
|
+
begin
|
49
|
+
@cucumber_erb = ERB.new(IO.read('cucumber.yml')).result
|
50
|
+
rescue Exception => e
|
51
|
+
raise(YmlLoadError,"cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage.\n#{$!.inspect}")
|
52
|
+
end
|
53
|
+
|
54
|
+
begin
|
55
|
+
@cucumber_yml = YAML::load(@cucumber_erb)
|
56
|
+
rescue StandardError => e
|
57
|
+
raise(YmlLoadError,"cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
|
58
|
+
end
|
59
|
+
|
60
|
+
if @cucumber_yml.nil? || !@cucumber_yml.is_a?(Hash)
|
61
|
+
raise(YmlLoadError,"cucumber.yml was found, but was blank or malformed. Please refer to cucumber's documentation on correct profile usage.\n")
|
62
|
+
end
|
63
|
+
|
64
|
+
return @cucumber_yml
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Constantize #:nodoc:
|
3
|
+
def constantize(camel_cased_word)
|
4
|
+
begin
|
5
|
+
names = camel_cased_word.split('::')
|
6
|
+
names.shift if names.empty? || names.first.empty?
|
7
|
+
|
8
|
+
constant = Object
|
9
|
+
names.each do |name|
|
10
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
11
|
+
end
|
12
|
+
constant
|
13
|
+
rescue NameError
|
14
|
+
require underscore(camel_cased_word)
|
15
|
+
retry
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Snagged from active_support
|
20
|
+
def underscore(camel_cased_word)
|
21
|
+
camel_cased_word.to_s.gsub(/::/, '/').
|
22
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
23
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
24
|
+
tr("-", "_").
|
25
|
+
downcase
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'cucumber/platform'
|
2
|
+
|
3
|
+
module Cucumber
|
4
|
+
# Raised if the number of a StepDefinition's Regexp match groups
|
5
|
+
# is different from the number of Proc arguments.
|
6
|
+
class ArityMismatchError < StandardError
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Object #:nodoc:
|
11
|
+
def cucumber_instance_exec(check_arity, pseudo_method, *args, &block)
|
12
|
+
cucumber_run_with_backtrace_filtering(pseudo_method) do
|
13
|
+
if check_arity && !cucumber_compatible_arity?(args, block)
|
14
|
+
instance_exec do
|
15
|
+
ari = cucumber_arity(block)
|
16
|
+
ari = ari < 0 ? (ari.abs-1).to_s+"+" : ari
|
17
|
+
s1 = ari == 1 ? "" : "s"
|
18
|
+
s2 = args.length == 1 ? "" : "s"
|
19
|
+
raise Cucumber::ArityMismatchError.new(
|
20
|
+
"Your block takes #{ari} argument#{s1}, but the Regexp matched #{args.length} argument#{s2}."
|
21
|
+
)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
instance_exec(*Cucumber::StepMother.transform_arguments(args), &block)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def cucumber_arity(block)
|
32
|
+
a = block.arity
|
33
|
+
Cucumber::RUBY_1_9 ? a : (a == -1 ? 0 : a)
|
34
|
+
end
|
35
|
+
|
36
|
+
def cucumber_compatible_arity?(args, block)
|
37
|
+
ari = cucumber_arity(block)
|
38
|
+
len = args.length
|
39
|
+
return true if ari == len or ari < 0 && len >= ari.abs-1
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
43
|
+
def cucumber_run_with_backtrace_filtering(pseudo_method)
|
44
|
+
begin
|
45
|
+
yield
|
46
|
+
rescue Exception => e
|
47
|
+
instance_exec_invocation_line = "#{__FILE__}:#{__LINE__ - 2}:in `cucumber_run_with_backtrace_filtering'"
|
48
|
+
replace_instance_exec_invocation_line!((e.backtrace || []), instance_exec_invocation_line, pseudo_method)
|
49
|
+
raise e
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
INSTANCE_EXEC_OFFSET = (Cucumber::RUBY_1_9 || Cucumber::JRUBY) ? -3 : -4
|
54
|
+
|
55
|
+
def replace_instance_exec_invocation_line!(backtrace, instance_exec_invocation_line, pseudo_method)
|
56
|
+
return if Cucumber.use_full_backtrace
|
57
|
+
|
58
|
+
instance_exec_pos = backtrace.index(instance_exec_invocation_line)
|
59
|
+
if instance_exec_pos
|
60
|
+
replacement_line = instance_exec_pos + INSTANCE_EXEC_OFFSET
|
61
|
+
backtrace[replacement_line].gsub!(/`.*'/, "`#{pseudo_method}'") if pseudo_method
|
62
|
+
backtrace[replacement_line+1..-1] = nil
|
63
|
+
|
64
|
+
backtrace.compact!
|
65
|
+
else
|
66
|
+
# This happens with rails, because they screw up the backtrace
|
67
|
+
# before we get here (injecting erb stacktrace and such)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
unless defined? instance_exec # 1.9
|
72
|
+
# http://eigenclass.org/hiki/bounded+space+instance_exec
|
73
|
+
module InstanceExecHelper #:nodoc:
|
74
|
+
end
|
75
|
+
include InstanceExecHelper
|
76
|
+
def instance_exec(*args, &block)
|
77
|
+
begin
|
78
|
+
old_critical, Thread.critical = Thread.critical, true
|
79
|
+
n = 0
|
80
|
+
n += 1 while respond_to?(mname="__instance_exec#{n}")
|
81
|
+
InstanceExecHelper.module_eval{ define_method(mname, &block) }
|
82
|
+
ensure
|
83
|
+
Thread.critical = old_critical
|
84
|
+
end
|
85
|
+
begin
|
86
|
+
ret = send(mname, *args)
|
87
|
+
ensure
|
88
|
+
InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil
|
89
|
+
end
|
90
|
+
ret
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Proc extension to get more location info out of a proc
|
2
|
+
class Proc #:nodoc:
|
3
|
+
PROC_PATTERN = /[\d\w]+@(.*):(.*)>/
|
4
|
+
|
5
|
+
def to_comment_line
|
6
|
+
"# #{file_colon_line}"
|
7
|
+
end
|
8
|
+
|
9
|
+
def backtrace_line(name)
|
10
|
+
"#{file_colon_line}:in `#{name}'"
|
11
|
+
end
|
12
|
+
|
13
|
+
if Proc.new{}.to_s =~ PROC_PATTERN
|
14
|
+
def file_colon_line
|
15
|
+
path, line = *to_s.match(PROC_PATTERN)[1..2]
|
16
|
+
path = File.expand_path(path)
|
17
|
+
pwd = Dir.pwd
|
18
|
+
path = path[pwd.length+1..-1]
|
19
|
+
"#{path}:#{line}"
|
20
|
+
end
|
21
|
+
else
|
22
|
+
# This Ruby implementation doesn't implement Proc#to_s correctly
|
23
|
+
STDERR.puts "*** THIS RUBY IMPLEMENTATION DOESN'T REPORT FILE AND LINE FOR PROCS ***"
|
24
|
+
|
25
|
+
def file_colon_line
|
26
|
+
"UNKNOWN:-1"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class String #:nodoc:
|
2
|
+
def indent(n)
|
3
|
+
if n >= 0
|
4
|
+
gsub(/^/, ' ' * n)
|
5
|
+
else
|
6
|
+
gsub(/^ {0,#{-n}}/, "")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# re.source.gsub(/\([^)]*\)/, '$var')
|
11
|
+
# Cumulative #sub
|
12
|
+
def subs(re, *args)
|
13
|
+
args.inject(self) do |s,arg|
|
14
|
+
s.sub(re, arg)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# TODO: Use subs instead...
|
19
|
+
def gzub(regexp, format=nil, &proc)
|
20
|
+
md = match(regexp)
|
21
|
+
raise "#{self.inspect} doesn't match #{regexp.inspect}" if md.nil?
|
22
|
+
|
23
|
+
s = dup
|
24
|
+
pos = 0
|
25
|
+
md.captures.each_with_index do |m, n|
|
26
|
+
replacement = if block_given?
|
27
|
+
proc.call(m)
|
28
|
+
elsif Proc === format
|
29
|
+
format.call(m)
|
30
|
+
else
|
31
|
+
format % m
|
32
|
+
end
|
33
|
+
|
34
|
+
if md.offset(n+1)[0]
|
35
|
+
s[md.offset(n+1)[0] + pos, m.length] = replacement
|
36
|
+
pos += replacement.length - m.length
|
37
|
+
end
|
38
|
+
end
|
39
|
+
s
|
40
|
+
end
|
41
|
+
|
42
|
+
if (Cucumber::JRUBY && Cucumber::RAILS) || Cucumber::RUBY_1_9
|
43
|
+
# Workaround for http://tinyurl.com/55uu3u
|
44
|
+
alias jlength length
|
45
|
+
else
|
46
|
+
require 'jcode'
|
47
|
+
end
|
48
|
+
end
|