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,36 @@
|
|
1
|
+
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
|
2
|
+
|
3
|
+
unless ARGV.any? {|a| a =~ /^gems/}
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
namespace :cucumber do
|
8
|
+
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
9
|
+
t.fork = true # You may get faster startup if you set this to false
|
10
|
+
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}<%= spork? ? ' --drb' : '' %>"
|
11
|
+
end
|
12
|
+
|
13
|
+
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
14
|
+
t.fork = true # You may get faster startup if you set this to false
|
15
|
+
t.cucumber_opts = "--color --tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}<%= spork? ? ' --drb' : '' %>"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Run all features'
|
19
|
+
task :all => [:ok, :wip]
|
20
|
+
end
|
21
|
+
desc 'Alias for cucumber:ok'
|
22
|
+
task :cucumber => 'cucumber:ok'
|
23
|
+
|
24
|
+
task :default => :cucumber
|
25
|
+
|
26
|
+
task :features => :cucumber do
|
27
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
28
|
+
end
|
29
|
+
rescue LoadError
|
30
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
31
|
+
task :cucumber do
|
32
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
config.cache_classes = true # This must be true for Cucumber to operate correctly!
|
2
|
+
|
3
|
+
# Log error messages when you accidentally call methods on nil.
|
4
|
+
config.whiny_nils = true
|
5
|
+
|
6
|
+
# Show full error reports and disable caching
|
7
|
+
config.action_controller.consider_all_requests_local = true
|
8
|
+
config.action_controller.perform_caching = false
|
9
|
+
|
10
|
+
# Disable request forgery protection in test environment
|
11
|
+
config.action_controller.allow_forgery_protection = false
|
12
|
+
|
13
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
14
|
+
# The :test delivery method accumulates sent emails in the
|
15
|
+
# ActionMailer::Base.deliveries array.
|
16
|
+
config.action_mailer.delivery_method = :test
|
17
|
+
|
18
|
+
config.gem 'cucumber', :lib => false, :version => '>=<%= cucumber_version %>' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
|
19
|
+
config.gem 'webrat', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
20
|
+
<% if framework == :rspec -%>
|
21
|
+
config.gem 'rspec', :lib => false, :version => '>=1.2.6' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
22
|
+
config.gem 'rspec-rails', :lib => 'spec/rails', :version => '>=1.2.6' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
23
|
+
<% end %>
|
24
|
+
<% if spork? -%>
|
25
|
+
config.gem 'spork', :lib => false, :version => '>=0.5.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/spork'))
|
26
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Sets up the Rails environment for Cucumber
|
2
|
+
ENV["RAILS_ENV"] ||= "cucumber"
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
4
|
+
require 'cucumber/rails/world'
|
5
|
+
|
6
|
+
# Comment out the next line if you don't want Cucumber Unicode support
|
7
|
+
require 'cucumber/formatter/unicode'
|
8
|
+
|
9
|
+
# Comment out the next line if you don't want transactions to
|
10
|
+
# open/roll back around each scenario
|
11
|
+
Cucumber::Rails.use_transactional_fixtures
|
12
|
+
|
13
|
+
# Comment out the next line if you want Rails' own error handling
|
14
|
+
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
|
15
|
+
Cucumber::Rails.bypass_rescue
|
16
|
+
|
17
|
+
require 'webrat'
|
18
|
+
require 'cucumber/webrat/element_locator' # Lets you do table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table)
|
19
|
+
|
20
|
+
Webrat.configure do |config|
|
21
|
+
config.mode = :rails
|
22
|
+
end
|
23
|
+
<% if framework == :rspec -%>
|
24
|
+
|
25
|
+
require 'cucumber/rails/rspec'
|
26
|
+
require 'webrat/core/matchers'
|
27
|
+
<% end -%>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
# Maps a name to a path. Used by the
|
3
|
+
#
|
4
|
+
# When /^I go to (.+)$/ do |page_name|
|
5
|
+
#
|
6
|
+
# step definition in webrat_steps.rb
|
7
|
+
#
|
8
|
+
def path_to(page_name)
|
9
|
+
case page_name
|
10
|
+
|
11
|
+
when /the homepage/
|
12
|
+
'/'
|
13
|
+
|
14
|
+
# Add more mappings here.
|
15
|
+
# Here is a more fancy example:
|
16
|
+
#
|
17
|
+
# when /^(.*)'s profile page$/i
|
18
|
+
# user_profile_path(User.find_by_login($1))
|
19
|
+
|
20
|
+
else
|
21
|
+
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
22
|
+
"Now, go and add a mapping in #{__FILE__}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
World(NavigationHelpers)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spork'
|
3
|
+
|
4
|
+
Spork.prefork do
|
5
|
+
# Sets up the Rails environment for Cucumber
|
6
|
+
ENV["RAILS_ENV"] = "cucumber"
|
7
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
8
|
+
|
9
|
+
require 'webrat'
|
10
|
+
require 'cucumber/webrat/element_locator' # Lets you do table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table)
|
11
|
+
|
12
|
+
Webrat.configure do |config|
|
13
|
+
config.mode = :rails
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'webrat/core/matchers'
|
17
|
+
require 'cucumber'
|
18
|
+
|
19
|
+
# Comment out the next line if you don't want Cucumber Unicode support
|
20
|
+
require 'cucumber/formatter/unicode'
|
21
|
+
require 'spec/rails'
|
22
|
+
require 'cucumber/rails/rspec'
|
23
|
+
end
|
24
|
+
|
25
|
+
Spork.each_run do
|
26
|
+
# This code will be run each time you run your specs.
|
27
|
+
|
28
|
+
# Comment out the next line if you don't want transactions to
|
29
|
+
# open/roll back around each scenario
|
30
|
+
Cucumber::Rails.use_transactional_fixtures
|
31
|
+
|
32
|
+
# Comment out the next line if you want Rails' own error handling
|
33
|
+
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
|
34
|
+
Cucumber::Rails.bypass_rescue
|
35
|
+
end
|
@@ -0,0 +1,236 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
2
|
+
|
3
|
+
# Commonly used webrat steps
|
4
|
+
# http://github.com/brynary/webrat
|
5
|
+
|
6
|
+
Given /^I am on (.+)$/ do |page_name|
|
7
|
+
visit path_to(page_name)
|
8
|
+
end
|
9
|
+
|
10
|
+
When /^I go to (.+)$/ do |page_name|
|
11
|
+
visit path_to(page_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
When /^I press "([^\"]*)"$/ do |button|
|
15
|
+
click_button(button)
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I follow "([^\"]*)"$/ do |link|
|
19
|
+
click_link(link)
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^I follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
|
23
|
+
click_link_within(parent, link)
|
24
|
+
end
|
25
|
+
|
26
|
+
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
27
|
+
fill_in(field, :with => value)
|
28
|
+
end
|
29
|
+
|
30
|
+
When /^I fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field|
|
31
|
+
fill_in(field, :with => value)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Use this to fill in an entire form with data from a table. Example:
|
35
|
+
#
|
36
|
+
# When I fill in the following:
|
37
|
+
# | Account Number | 5002 |
|
38
|
+
# | Expiry date | 2009-11-01 |
|
39
|
+
# | Note | Nice guy |
|
40
|
+
# | Wants Email? | |
|
41
|
+
#
|
42
|
+
# TODO: Add support for checkbox, select og option
|
43
|
+
# based on naming conventions.
|
44
|
+
#
|
45
|
+
When /^I fill in the following:$/ do |fields|
|
46
|
+
fields.rows_hash.each do |name, value|
|
47
|
+
When %{I fill in "#{name}" with "#{value}"}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
52
|
+
select(value, :from => field)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
56
|
+
# When I select "December 25, 2008 10:00" as the date and time
|
57
|
+
When /^I select "([^\"]*)" as the date and time$/ do |time|
|
58
|
+
select_datetime(time)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Use this step when using multiple datetime_select helpers on a page or
|
62
|
+
# you want to specify which datetime to select. Given the following view:
|
63
|
+
# <%%= f.label :preferred %><br />
|
64
|
+
# <%%= f.datetime_select :preferred %>
|
65
|
+
# <%%= f.label :alternative %><br />
|
66
|
+
# <%%= f.datetime_select :alternative %>
|
67
|
+
# The following steps would fill out the form:
|
68
|
+
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
69
|
+
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
70
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
71
|
+
select_datetime(datetime, :from => datetime_label)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Use this step in conjunction with Rail's time_select helper. For example:
|
75
|
+
# When I select "2:20PM" as the time
|
76
|
+
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
77
|
+
# will convert the 2:20PM to 14:20 and then select it.
|
78
|
+
When /^I select "([^\"]*)" as the time$/ do |time|
|
79
|
+
select_time(time)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Use this step when using multiple time_select helpers on a page or you want to
|
83
|
+
# specify the name of the time on the form. For example:
|
84
|
+
# When I select "7:30AM" as the "Gym" time
|
85
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
86
|
+
select_time(time, :from => time_label)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Use this step in conjunction with Rail's date_select helper. For example:
|
90
|
+
# When I select "February 20, 1981" as the date
|
91
|
+
When /^I select "([^\"]*)" as the date$/ do |date|
|
92
|
+
select_date(date)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Use this step when using multiple date_select helpers on one page or
|
96
|
+
# you want to specify the name of the date on the form. For example:
|
97
|
+
# When I select "April 26, 1982" as the "Date of Birth" date
|
98
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
99
|
+
select_date(date, :from => date_label)
|
100
|
+
end
|
101
|
+
|
102
|
+
When /^I check "([^\"]*)"$/ do |field|
|
103
|
+
check(field)
|
104
|
+
end
|
105
|
+
|
106
|
+
When /^I uncheck "([^\"]*)"$/ do |field|
|
107
|
+
uncheck(field)
|
108
|
+
end
|
109
|
+
|
110
|
+
When /^I choose "([^\"]*)"$/ do |field|
|
111
|
+
choose(field)
|
112
|
+
end
|
113
|
+
|
114
|
+
When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
115
|
+
attach_file(field, path)
|
116
|
+
end
|
117
|
+
|
118
|
+
Then /^I should see "([^\"]*)"$/ do |text|
|
119
|
+
<% if framework == :rspec -%>
|
120
|
+
response.should contain(text)
|
121
|
+
<% else -%>
|
122
|
+
assert_contain text
|
123
|
+
<% end -%>
|
124
|
+
end
|
125
|
+
|
126
|
+
Then /^I should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
127
|
+
within(selector) do |content|
|
128
|
+
<% if framework == :rspec -%>
|
129
|
+
content.should contain(text)
|
130
|
+
<% else -%>
|
131
|
+
assert content.include?(text)
|
132
|
+
<% end -%>
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
Then /^I should see \/([^\/]*)\/$/ do |regexp|
|
137
|
+
regexp = Regexp.new(regexp)
|
138
|
+
<% if framework == :rspec -%>
|
139
|
+
response.should contain(regexp)
|
140
|
+
<% else -%>
|
141
|
+
assert_contain regexp
|
142
|
+
<% end -%>
|
143
|
+
end
|
144
|
+
|
145
|
+
Then /^I should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
146
|
+
within(selector) do |content|
|
147
|
+
regexp = Regexp.new(regexp)
|
148
|
+
<% if framework == :rspec -%>
|
149
|
+
content.should contain(regexp)
|
150
|
+
<% else -%>
|
151
|
+
assert content =~ regexp
|
152
|
+
<% end -%>
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
Then /^I should not see "([^\"]*)"$/ do |text|
|
157
|
+
<% if framework == :rspec -%>
|
158
|
+
response.should_not contain(text)
|
159
|
+
<% else -%>
|
160
|
+
assert_not_contain text
|
161
|
+
<% end -%>
|
162
|
+
end
|
163
|
+
|
164
|
+
Then /^I should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
165
|
+
within(selector) do |content|
|
166
|
+
<% if framework == :rspec -%>
|
167
|
+
content.should_not contain(text)
|
168
|
+
<% else -%>
|
169
|
+
assert !content.include?(text)
|
170
|
+
<% end -%>
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
Then /^I should not see \/([^\/]*)\/$/ do |regexp|
|
175
|
+
regexp = Regexp.new(regexp)
|
176
|
+
<% if framework == :rspec -%>
|
177
|
+
response.should_not contain(regexp)
|
178
|
+
<% else -%>
|
179
|
+
assert_not_contain regexp
|
180
|
+
<% end -%>
|
181
|
+
end
|
182
|
+
|
183
|
+
Then /^I should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
184
|
+
within(selector) do |content|
|
185
|
+
regexp = Regexp.new(regexp)
|
186
|
+
<% if framework == :rspec -%>
|
187
|
+
content.should_not contain(regexp)
|
188
|
+
<% else -%>
|
189
|
+
assert content !~ regexp
|
190
|
+
<% end -%>
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
195
|
+
<% if framework == :rspec -%>
|
196
|
+
field_labeled(field).value.should =~ /#{value}/
|
197
|
+
<% else -%>
|
198
|
+
assert_match(/#{value}/, field_labeled(field).value)
|
199
|
+
<% end -%>
|
200
|
+
end
|
201
|
+
|
202
|
+
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
203
|
+
<% if framework == :rspec -%>
|
204
|
+
field_labeled(field).value.should_not =~ /#{value}/
|
205
|
+
<% else -%>
|
206
|
+
assert_no_match(/#{value}/, field_labeled(field).value)
|
207
|
+
<% end -%>
|
208
|
+
end
|
209
|
+
|
210
|
+
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
211
|
+
<% if framework == :rspec -%>
|
212
|
+
field_labeled(label).should be_checked
|
213
|
+
<% else -%>
|
214
|
+
assert field_labeled(label).checked?
|
215
|
+
<% end -%>
|
216
|
+
end
|
217
|
+
|
218
|
+
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
|
219
|
+
<% if framework == :rspec -%>
|
220
|
+
field_labeled(label).should_not be_checked
|
221
|
+
<% else -%>
|
222
|
+
assert !field_labeled(label).checked?
|
223
|
+
<% end -%>
|
224
|
+
end
|
225
|
+
|
226
|
+
Then /^I should be on (.+)$/ do |page_name|
|
227
|
+
<% if framework == :rspec -%>
|
228
|
+
URI.parse(current_url).path.should == path_to(page_name)
|
229
|
+
<% else -%>
|
230
|
+
assert_equal path_to(page_name), URI.parse(current_url).path
|
231
|
+
<% end -%>
|
232
|
+
end
|
233
|
+
|
234
|
+
Then /^show me the page$/ do
|
235
|
+
save_and_open_page
|
236
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Description:
|
2
|
+
Generates a skeleton for a new feature. Both a simple .feature file and
|
3
|
+
a steps.rb file is generated. This generator should be used with moderation.
|
4
|
+
See http://github.com/aslakhellesoy/cucumber/wikis/feature-coupled-steps-antipattern
|
5
|
+
for details about the dangers involved.
|
6
|
+
|
7
|
+
This generator can take an optional list of attribute pairs similar to Rails'
|
8
|
+
built-in resource generator.
|
9
|
+
|
10
|
+
Examples:
|
11
|
+
`./script/generate feature post` # no attributes
|
12
|
+
`./script/generate feature post title:string body:text published:boolean`
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# This generator generates a baic feature.
|
2
|
+
class FeatureGenerator < Rails::Generator::NamedBase
|
3
|
+
def manifest
|
4
|
+
record do |m|
|
5
|
+
m.directory 'features/step_definitions'
|
6
|
+
m.template 'feature.erb', "features/manage_#{plural_name}.feature"
|
7
|
+
m.template 'steps.erb', "features/step_definitions/#{singular_name}_steps.rb"
|
8
|
+
|
9
|
+
m.gsub_file 'features/support/paths.rb', /'\/'/mi do |match|
|
10
|
+
"#{match}\n when /the new #{singular_name} page/\n new_#{singular_name}_path\n"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class NamedArg
|
16
|
+
attr_reader :name
|
17
|
+
|
18
|
+
def initialize(s)
|
19
|
+
@name, @type = *s.split(':')
|
20
|
+
end
|
21
|
+
|
22
|
+
def value(n)
|
23
|
+
if @type == 'boolean'
|
24
|
+
(n % 2) == 0
|
25
|
+
else
|
26
|
+
"#{@name} #{n}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def named_args
|
32
|
+
args.map{|arg| NamedArg.new(arg)}
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def banner
|
38
|
+
"Usage: #{$0} feature ModelName [field:type, field:type]"
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: Manage <%= plural_name %>
|
2
|
+
In order to [goal]
|
3
|
+
[stakeholder]
|
4
|
+
wants [behaviour]
|
5
|
+
|
6
|
+
Scenario: Register new <%= singular_name %>
|
7
|
+
Given I am on the new <%= singular_name %> page
|
8
|
+
<% keyword = 'When' -%>
|
9
|
+
<% named_args.each do |arg| -%>
|
10
|
+
<%= keyword %> I fill in "<%= arg.name.humanize %>" with "<%= arg.value(1) %>"
|
11
|
+
<% keyword = 'And' -%>
|
12
|
+
<% end -%>
|
13
|
+
And I press "Create"
|
14
|
+
<% keyword = 'Then' -%>
|
15
|
+
<% named_args.each do |arg| -%>
|
16
|
+
<%= keyword %> I should see "<%= arg.value(1) %>"
|
17
|
+
<% keyword = 'And' -%>
|
18
|
+
<% end -%>
|
19
|
+
|
20
|
+
Scenario: Delete <%= singular_name %>
|
21
|
+
Given the following <%= plural_name %>:
|
22
|
+
|<%= named_args.map(&:name).join('|') %>|
|
23
|
+
<% (1..4).each do |n| -%>
|
24
|
+
|<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
|
25
|
+
<% end -%>
|
26
|
+
When I delete the 3rd <%= singular_name %>
|
27
|
+
Then I should see the following <%= plural_name %>:
|
28
|
+
|<%= named_args.map{|arg| arg.name.humanize}.join('|') %>|
|
29
|
+
<% [1,2,4].each do |n| -%>
|
30
|
+
|<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
|
31
|
+
<% end -%>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Given /^the following <%= plural_name %>:$/ do |<%= plural_name %>|
|
2
|
+
<%= class_name %>.create!(<%= plural_name %>.hashes)
|
3
|
+
end
|
4
|
+
|
5
|
+
When /^I delete the (\d+)(?:st|nd|rd|th) <%= singular_name %>$/ do |pos|
|
6
|
+
visit <%= plural_name %>_url
|
7
|
+
within("table > tr:nth-child(#{pos.to_i+1})") do
|
8
|
+
click_link "Destroy"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Then /^I should see the following <%= plural_name %>:$/ do |expected_<%= plural_name %>_table|
|
13
|
+
expected_<%= plural_name %>_table.diff!(table_at('table').to_a)
|
14
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require 'cucumber/ast'
|
3
|
+
require 'cucumber/rb_support/rb_language'
|
4
|
+
|
5
|
+
module Cucumber
|
6
|
+
module Ast
|
7
|
+
describe Background do
|
8
|
+
|
9
|
+
before do
|
10
|
+
extend(RbSupport::RbDsl)
|
11
|
+
@step_mother = StepMother.new
|
12
|
+
@step_mother.load_natural_language('en')
|
13
|
+
@rb = @step_mother.load_programming_language('rb')
|
14
|
+
|
15
|
+
$x = $y = nil
|
16
|
+
Before do
|
17
|
+
$x = 2
|
18
|
+
end
|
19
|
+
Given /y is (\d+)/ do |n|
|
20
|
+
$y = $x * n.to_i
|
21
|
+
end
|
22
|
+
|
23
|
+
register
|
24
|
+
|
25
|
+
@visitor = Visitor.new(@step_mother)
|
26
|
+
@visitor.options = {}
|
27
|
+
|
28
|
+
@feature = mock('feature', :visit? => true).as_null_object
|
29
|
+
end
|
30
|
+
|
31
|
+
def register
|
32
|
+
@step_mother.register_step_definitions(@rb.step_definitions)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should execute Before blocks before background steps" do
|
36
|
+
background = Background.new(
|
37
|
+
comment=Comment.new(''),
|
38
|
+
line=2,
|
39
|
+
keyword="",
|
40
|
+
name="",
|
41
|
+
steps=[
|
42
|
+
Step.new(7, "Given", "y is 5")
|
43
|
+
])
|
44
|
+
|
45
|
+
scenario = Scenario.new(
|
46
|
+
background,
|
47
|
+
comment=Comment.new(""),
|
48
|
+
tags=Tags.new(98,[]),
|
49
|
+
line=99,
|
50
|
+
keyword="",
|
51
|
+
name="",
|
52
|
+
steps=[])
|
53
|
+
background.feature = @feature
|
54
|
+
@visitor.visit_background(background)
|
55
|
+
$x.should == 2
|
56
|
+
$y.should == 10
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require 'cucumber/step_mother'
|
3
|
+
require 'cucumber/ast'
|
4
|
+
|
5
|
+
module Cucumber
|
6
|
+
describe FeatureElement do
|
7
|
+
include FeatureElement
|
8
|
+
|
9
|
+
describe "with multiline names" do
|
10
|
+
it "should select the longest line as the text length" do
|
11
|
+
@keyword = "key"
|
12
|
+
@name = "short\nvery longer\ntiny"
|
13
|
+
text_length.should == 11 + Ast::Step::INDENT - 1
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should add keyword to first lines length" do
|
17
|
+
@keyword = "key"
|
18
|
+
@name = "short\nvery longer\ntiny"
|
19
|
+
|
20
|
+
first_line_length.should == (@keyword.jlength) + (first_line_name_length = 5)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "with empty name" do
|
25
|
+
it "should only return the length of the keyword" do
|
26
|
+
@name = ""
|
27
|
+
@keyword = "key"
|
28
|
+
|
29
|
+
text_length.should == 3
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should support checking if its name matches a list of regexps" do
|
34
|
+
@name = 'test'
|
35
|
+
matches_scenario_names?([/es/]).should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'cucumber/ast'
|
2
|
+
require 'cucumber/step_mother'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
module Ast
|
6
|
+
module FeatureFactory
|
7
|
+
class MyWorld
|
8
|
+
def flunk
|
9
|
+
raise "I flunked"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_feature(dsl)
|
14
|
+
dsl.Given /^a (.*) step with an inline arg:$/ do |what, table|
|
15
|
+
end
|
16
|
+
dsl.Given /^a (.*) step$/ do |what|
|
17
|
+
flunk if what == 'failing'
|
18
|
+
end
|
19
|
+
dsl.World do
|
20
|
+
MyWorld.new
|
21
|
+
end
|
22
|
+
|
23
|
+
table = Ast::Table.new([
|
24
|
+
%w{1 22 333},
|
25
|
+
%w{4444 55555 666666}
|
26
|
+
])
|
27
|
+
py_string = Ast::PyString.new(21, 22, %{
|
28
|
+
I like
|
29
|
+
Cucumber sandwich
|
30
|
+
}, 10)
|
31
|
+
|
32
|
+
background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "",
|
33
|
+
[
|
34
|
+
Step.new(3, "Given", "a passing step")
|
35
|
+
]
|
36
|
+
)
|
37
|
+
|
38
|
+
f = Ast::Feature.new(
|
39
|
+
background,
|
40
|
+
Ast::Comment.new("# My feature comment\n"),
|
41
|
+
Ast::Tags.new(6, ['one', 'two']),
|
42
|
+
"Pretty printing",
|
43
|
+
[Ast::Scenario.new(
|
44
|
+
background,
|
45
|
+
Ast::Comment.new(" # My scenario comment \n# On two lines \n"),
|
46
|
+
Ast::Tags.new(8, ['three', 'four']),
|
47
|
+
9,
|
48
|
+
"Scenario:", "A Scenario",
|
49
|
+
[
|
50
|
+
Step.new(10, "Given", "a passing step with an inline arg:", table),
|
51
|
+
Step.new(11, "Given", "a happy step with an inline arg:", py_string),
|
52
|
+
Step.new(12, "Given", "a failing step")
|
53
|
+
]
|
54
|
+
)]
|
55
|
+
)
|
56
|
+
f.file = 'features/pretty_printing.feature'
|
57
|
+
f.features = Features.new
|
58
|
+
f
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|