├── .rspec ├── .rvmrc ├── fixtures ├── self_test │ ├── .gitignore │ ├── list-of-features.txt │ ├── features │ │ ├── failing_expectation.feature │ │ ├── lots_of_undefined.feature │ │ ├── undefined_multiline_args.feature │ │ ├── call_undefined_step_from_step_def.feature │ │ ├── tags_sample.feature │ │ ├── sample.feature │ │ ├── outline_sample.feature │ │ ├── support │ │ │ └── env.rb │ │ ├── search_sample.feature │ │ └── multiline_name.feature │ ├── Rakefile │ └── README.textile ├── tickets │ ├── features │ │ ├── 177 │ │ │ ├── 3.feature │ │ │ ├── 1.feature │ │ │ └── 2.feature │ │ ├── 229 │ │ │ ├── tagged_hooks.feature │ │ │ └── tagged_hooks.rb │ │ ├── 270 │ │ │ ├── back.feature │ │ │ └── back.steps.rb │ │ ├── 272 │ │ │ └── hooks.feature │ │ ├── 279 │ │ │ ├── wrong.feature_ │ │ │ ├── py_string_indent.steps.rb │ │ │ └── py_string_indent.feature │ │ ├── 301 │ │ │ ├── filter_background_tagged_hooks.feature │ │ │ └── filter_background_tagged_hooks_steps.rb │ │ ├── 306 │ │ │ └── only_background.feature │ │ ├── gherkin_68.feature │ │ ├── step_definitons │ │ │ ├── 246_steps.rb │ │ │ ├── around_timeout_steps.rb │ │ │ ├── 248_steps.rb │ │ │ └── half_manual_steps.rb │ │ ├── around_timeout.feature │ │ ├── gherkin_67.feature │ │ ├── 180.feature │ │ ├── 246.feature │ │ ├── 248.feature │ │ ├── half_manual.feature │ │ ├── lib │ │ │ ├── pantry.rb │ │ │ └── eatting_machine.rb │ │ ├── table_diffing.feature │ │ ├── 241.feature │ │ ├── 236.feature │ │ ├── tickets.feature │ │ └── 172.feature │ └── Rakefile ├── json │ └── features │ │ ├── embed.feature │ │ ├── background.feature │ │ ├── one_passing_one_failing.feature │ │ ├── tables.feature │ │ └── step_definitions │ │ └── steps.rb ├── junit │ └── features │ │ ├── pending.feature │ │ ├── step_definitions │ │ └── steps.rb │ │ └── one_passing_one_failing.feature └── steps_library │ └── features │ └── step_definitions │ ├── steps_lib2.rb │ └── steps_lib1.rb ├── examples ├── i18n │ ├── de │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── step_definitons │ │ │ └── calculator_steps.rb │ │ │ └── addition.feature │ ├── en │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── eo │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── divido.feature │ │ │ ├── adicio.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── fi │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── laskin.rb │ │ └── features │ │ │ ├── jakolasku.feature │ │ │ ├── step_definitons │ │ │ └── laskin_steps.rb │ │ │ └── yhteenlasku.feature │ ├── hu │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── osztas.feature │ │ │ ├── osszeadas.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── id │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── step_definitons │ │ │ └── calculator_steps.rb │ │ │ └── addition.feature │ ├── ja │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── features │ │ │ ├── division.feature │ │ │ ├── support │ │ │ │ └── env.rb │ │ │ ├── step_definitons │ │ │ │ └── calculator_steps.rb │ │ │ └── addition.feature │ │ └── lib │ │ │ └── calculator.rb │ ├── ko │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── features │ │ │ ├── division.feature │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ │ └── calculator_steps.rb │ │ └── lib │ │ │ └── calculator.rb │ ├── lt │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── step_definitons │ │ │ └── calculator_steps.rb │ │ │ └── addition.feature │ ├── pl │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── features │ │ │ ├── support │ │ │ │ └── env.rb │ │ │ ├── division.feature │ │ │ ├── step_definitons │ │ │ │ └── calculator_steps.rb │ │ │ └── addition.feature │ │ └── lib │ │ │ └── calculator.rb │ ├── sk │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── tr │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── hesap_makinesi.rb │ │ └── features │ │ │ ├── bolme.feature │ │ │ ├── step_definitons │ │ │ └── hesap_makinesi_adimlari.rb │ │ │ └── toplama.feature │ ├── zh-TW │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── features │ │ │ ├── division.feature │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ │ └── calculator_steps.rb │ │ └── lib │ │ │ └── calculator.rb │ ├── en-lol │ │ ├── Rakefile │ │ ├── lib │ │ │ ├── belly.rb │ │ │ └── basket.rb │ │ └── features │ │ │ ├── stuffing.feature │ │ │ ├── support │ │ │ └── env.rb │ │ │ └── step_definitions │ │ │ └── cucumbrz_steps.rb │ ├── zh-CN │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── bg │ │ ├── features │ │ │ ├── support │ │ │ │ ├── world.rb │ │ │ │ └── env.rb │ │ │ ├── addition.feature │ │ │ ├── step_definitons │ │ │ │ └── calculator_steps.rb │ │ │ ├── division.feature │ │ │ └── consecutive_calculations.feature │ │ ├── Rakefile │ │ └── lib │ │ │ └── calculator.rb │ ├── ru │ │ ├── features │ │ │ ├── support │ │ │ │ ├── world.rb │ │ │ │ └── env.rb │ │ │ ├── addition.feature │ │ │ ├── step_definitons │ │ │ │ └── calculator_steps.rb │ │ │ ├── division.feature │ │ │ └── consecutive_calculations.feature │ │ ├── Rakefile │ │ └── lib │ │ │ └── calculator.rb │ ├── uk │ │ ├── features │ │ │ ├── support │ │ │ │ ├── world.rb │ │ │ │ └── env.rb │ │ │ ├── addition.feature │ │ │ ├── step_definitons │ │ │ │ └── calculator_steps.rb │ │ │ ├── consecutive_calculations.feature │ │ │ └── division.feature │ │ ├── Rakefile │ │ └── lib │ │ │ └── calculator.rb │ ├── uz │ │ ├── features │ │ │ ├── support │ │ │ │ ├── world.rb │ │ │ │ └── env.rb │ │ │ ├── addition.feature │ │ │ ├── step_definitons │ │ │ │ └── calculator_steps.rb │ │ │ ├── consecutive_calculations.feature │ │ │ └── division.feature │ │ ├── Rakefile │ │ └── lib │ │ │ └── calculator.rb │ ├── ar │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── ca │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculadora.rb │ │ └── features │ │ │ ├── step_definitons │ │ │ └── calculator_steps.rb │ │ │ └── suma.feature │ ├── da │ │ ├── Rakefile │ │ ├── lib │ │ │ └── lommeregner.rb │ │ └── features │ │ │ ├── sammenlaegning.feature │ │ │ └── step_definitons │ │ │ └── lommeregner_steps.rb │ ├── es │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculador.rb │ │ └── features │ │ │ ├── step_definitons │ │ │ └── calculador_steps.rb │ │ │ └── adicion.feature │ ├── et │ │ ├── Rakefile │ │ ├── lib │ │ │ └── kalkulaator.rb │ │ └── features │ │ │ ├── jagamine.feature │ │ │ ├── liitmine.feature │ │ │ └── step_definitions │ │ │ └── kalkulaator_steps.rb │ ├── fr │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculatrice.rb │ │ └── features │ │ │ ├── support │ │ │ └── env.rb │ │ │ ├── addition2.feature │ │ │ ├── addition.feature │ │ │ └── step_definitions │ │ │ └── calculatrice_steps.rb │ ├── it │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calcolatrice.rb │ │ └── features │ │ │ ├── somma.feature │ │ │ └── step_definitons │ │ │ └── calcolatrice_steps.rb │ ├── lv │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── step_definitons │ │ │ └── calculator_steps.rb │ │ │ └── addition.feature │ ├── no │ │ ├── Rakefile │ │ ├── lib │ │ │ └── kalkulator.rb │ │ └── features │ │ │ ├── support │ │ │ └── env.rb │ │ │ ├── step_definitons │ │ │ └── kalkulator_steps.rb │ │ │ └── summering.feature │ ├── pt │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculadora.rb │ │ └── features │ │ │ ├── support │ │ │ └── env.rb │ │ │ ├── adicao.feature │ │ │ └── step_definitions │ │ │ └── calculadora_steps.rb │ ├── sv │ │ ├── Rakefile │ │ ├── lib │ │ │ └── kalkulator.rb │ │ └── features │ │ │ ├── summering.feature │ │ │ └── step_definitons │ │ │ └── kalkulator_steps.rb │ ├── he │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── ro │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── adunare.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── sr-Cyrl │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── support │ │ │ └── env.rb │ │ │ ├── step_definitons │ │ │ └── calculator_steps.rb │ │ │ └── sabiranje.feature │ ├── sr-Latn │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── step_definitons │ │ │ └── calculator_steps.rb │ │ │ └── sabiranje.feature │ ├── README.textile │ └── Rakefile ├── python │ ├── lib │ │ ├── .gitignore │ │ └── fib.py │ ├── Rakefile │ ├── README.textile │ └── features │ │ ├── step_definitions │ │ └── fib_steps.py │ │ └── fibonacci.feature ├── watir │ ├── .gitignore │ ├── cucumber.yml │ ├── Rakefile │ ├── features │ │ ├── search.feature │ │ ├── support │ │ │ └── env.rb │ │ └── step_definitions │ │ │ └── search_steps.rb │ └── README.textile ├── ruby2python │ ├── lib │ │ ├── .gitignore │ │ └── fib.py │ ├── Rakefile │ ├── features │ │ ├── step_definitions │ │ │ └── fib_steps.rb │ │ ├── support │ │ │ └── env.rb │ │ └── fibonacci.feature │ └── README.textile ├── tcl │ ├── src │ │ └── fib.tcl │ ├── features │ │ ├── support │ │ │ └── env.rb │ │ ├── step_definitions │ │ │ └── fib_steps.rb │ │ └── fibonnacci.feature │ ├── Rakefile │ └── README.textile ├── rspec_doubles │ ├── Rakefile │ └── features │ │ ├── mocking.feature │ │ ├── support │ │ └── env.rb │ │ └── step_definitions │ │ └── calvin_steps.rb ├── sinatra │ ├── views │ │ ├── layout.erb │ │ └── add.erb │ ├── Rakefile │ ├── app.rb │ ├── features │ │ ├── add.feature │ │ ├── support │ │ │ └── env.rb │ │ └── step_definitions │ │ │ └── add_steps.rb │ └── README.textile ├── ramaze │ ├── README.textile │ ├── layout │ │ └── default.html.erb │ ├── view │ │ └── index.html.erb │ ├── Rakefile │ ├── features │ │ ├── add.feature │ │ ├── step_definitions │ │ │ └── add_steps.rb │ │ └── support │ │ │ └── env.rb │ └── app.rb ├── v8 │ ├── Rakefile │ ├── features │ │ └── support │ │ │ └── env.js │ └── lib │ │ └── fibonacci.js └── test_unit │ ├── Rakefile │ └── features │ ├── test_unit.feature │ └── step_definitions │ └── test_unit_steps.rb ├── .gitattributes ├── legacy_features ├── step_definitions │ ├── extra_steps.rb │ ├── simplest_steps.rb │ └── wire_steps.rb ├── simplest.feature ├── support │ └── env.rb.simplest ├── html_formatter.feature ├── bug_464.feature ├── bug_585_tab_indentation.feature ├── bug_371.feature ├── snippet.feature ├── language_from_header.feature ├── diffing.feature ├── unicode_table.feature ├── table_mapping.feature ├── exclude_files.feature ├── rerun_formatter.feature └── api │ └── run_cli_main_with_existing_runtime.feature ├── lib ├── cucumber │ ├── parser.rb │ ├── core_ext │ │ ├── string.rb │ │ ├── disable_mini_and_test_unit_autorun.rb │ │ └── proc.rb │ ├── step_argument.rb │ ├── py_support │ │ ├── py_dsl.py │ │ └── py_language.py │ ├── formatter │ │ ├── stepdefs.rb │ │ ├── json_pretty.rb │ │ ├── duration.rb │ │ ├── gpretty.rb │ │ ├── debug.rb │ │ ├── ordered_xml_markup.rb │ │ ├── json.rb │ │ └── io.rb │ ├── rspec │ │ ├── doubles.rb │ │ └── disable_option_parser.rb │ ├── step_mother.rb │ ├── ast │ │ ├── visitor.rb │ │ ├── tags.rb │ │ ├── features.rb │ │ └── comment.rb │ ├── broadcaster.rb │ ├── step_definitions.rb │ ├── rb_support │ │ ├── regexp_argument_matcher.rb │ │ └── rb_hook.rb │ ├── step_definition_light.rb │ ├── wire_support │ │ ├── wire_step_definition.rb │ │ ├── configuration.rb │ │ ├── request_handler.rb │ │ ├── wire_packet.rb │ │ └── wire_exception.rb │ ├── constantize.rb │ ├── configuration.rb │ ├── ast.rb │ ├── platform.rb │ ├── language_support.rb │ ├── js_support │ │ └── js_snippets.rb │ └── errors.rb ├── autotest │ ├── cucumber.rb │ ├── cucumber_rails.rb │ ├── cucumber_rspec.rb │ ├── cucumber_rspec2.rb │ ├── cucumber_rails_rspec.rb │ ├── cucumber_rails_rspec2.rb │ └── discover.rb ├── README.rdoc └── cucumber.rb ├── features ├── iso-8859-1.feature ├── step_definitions │ ├── iso-8859-1_steps.rb │ └── cucumber_steps.rb ├── bootstrap.feature └── support │ └── env.rb ├── Gemfile ├── gem_tasks ├── flog.rake ├── environment.rake ├── sass.rake ├── rspec.rake ├── fix_cr_lf.rake ├── examples.rake ├── sdoc.rake ├── cucumber.rake └── contributors.rake ├── spec ├── spec_helper.rb └── cucumber │ ├── ast │ ├── tree_walker_spec.rb │ └── outline_table_spec.rb │ ├── broadcaster_spec.rb │ ├── sell_cucumbers.feature │ ├── rb_support │ ├── rb_transform_spec.rb │ └── regexp_argument_matcher_spec.rb │ ├── formatter │ ├── duration_spec.rb │ └── ansicolor_spec.rb │ ├── configuration_spec.rb │ └── wire_support │ └── wire_step_definition_spec.rb ├── .gitignore ├── Rakefile ├── bin └── cucumber ├── README.rdoc ├── cucumber.yml └── LICENSE /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | -------------------------------------------------------------------------------- /.rvmrc: -------------------------------------------------------------------------------- 1 | rvm @cucumber --create 2 | -------------------------------------------------------------------------------- /fixtures/self_test/.gitignore: -------------------------------------------------------------------------------- 1 | tmp -------------------------------------------------------------------------------- /examples/i18n/de/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/en/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/eo/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/fi/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/hu/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/id/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/ja/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/ko/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/lt/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/pl/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/sk/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/tr/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/zh-TW/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/python/lib/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /examples/watir/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.png -------------------------------------------------------------------------------- /examples/ruby2python/lib/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | spec/cucumber/treetop_parser/test_dos.feature -crlf -------------------------------------------------------------------------------- /fixtures/self_test/list-of-features.txt: -------------------------------------------------------------------------------- 1 | features/sample.feature:12 2 | -------------------------------------------------------------------------------- /examples/watir/cucumber.yml: -------------------------------------------------------------------------------- 1 | default: --format html --out report.html --format pretty -------------------------------------------------------------------------------- /legacy_features/step_definitions/extra_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^missing$/ do 2 | end 3 | -------------------------------------------------------------------------------- /lib/cucumber/parser.rb: -------------------------------------------------------------------------------- 1 | require 'cucumber/platform' 2 | require 'cucumber/ast' 3 | -------------------------------------------------------------------------------- /legacy_features/step_definitions/simplest_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^this step works$/ do 2 | end 3 | 4 | -------------------------------------------------------------------------------- /features/iso-8859-1.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fd/cucumber/master/features/iso-8859-1.feature -------------------------------------------------------------------------------- /fixtures/tickets/features/gherkin_68.feature: -------------------------------------------------------------------------------- 1 | Feature: 2 | Scenario: 3 | Given I call empty steps 4 | -------------------------------------------------------------------------------- /examples/tcl/src/fib.tcl: -------------------------------------------------------------------------------- 1 | proc fib {n} { 2 | return [expr {$n<2 ? $n : [fib [expr $n-1]] + [fib [expr $n-2]]}] 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/json/features/embed.feature: -------------------------------------------------------------------------------- 1 | Feature: A screenshot feature 2 | 3 | Scenario: 4 | Given I embed a screenshot 5 | -------------------------------------------------------------------------------- /fixtures/junit/features/pending.feature: -------------------------------------------------------------------------------- 1 | Feature: Pending step 2 | 3 | Scenario: Pending 4 | Given a pending step 5 | 6 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | group :development do 4 | # gem 'gherkin', :path => '../gherkin' 5 | end 6 | 7 | gemspec 8 | -------------------------------------------------------------------------------- /examples/python/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new -------------------------------------------------------------------------------- /features/step_definitions/iso-8859-1_steps.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fd/cucumber/master/features/step_definitions/iso-8859-1_steps.rb -------------------------------------------------------------------------------- /fixtures/tickets/features/306/only_background.feature: -------------------------------------------------------------------------------- 1 | Feature: woo yeah 2 | 3 | Background: 4 | Given passing step without a table 5 | -------------------------------------------------------------------------------- /examples/i18n/en-lol/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new -------------------------------------------------------------------------------- /examples/i18n/zh-CN/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new -------------------------------------------------------------------------------- /examples/i18n/zh-TW/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new -------------------------------------------------------------------------------- /examples/rspec_doubles/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new -------------------------------------------------------------------------------- /examples/ruby2python/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new -------------------------------------------------------------------------------- /examples/sinatra/views/layout.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | Addition 4 | 5 | 6 | <%= yield %> 7 | 8 | -------------------------------------------------------------------------------- /fixtures/self_test/features/failing_expectation.feature: -------------------------------------------------------------------------------- 1 | Feature: Failing expectation 2 | 3 | Scenario: Failing expectation 4 | Given failing expectation 5 | -------------------------------------------------------------------------------- /examples/ramaze/README.textile: -------------------------------------------------------------------------------- 1 | h1. Ramaze and Cucumber 2 | 3 | This example will work with: 4 | 5 | * ramaze 2010.04.04 6 | * rack-test 0.5.3 7 | * webrat 0.7.0 8 | -------------------------------------------------------------------------------- /lib/autotest/cucumber.rb: -------------------------------------------------------------------------------- 1 | require 'autotest' 2 | require 'autotest/cucumber_mixin' 3 | 4 | class Autotest::Cucumber < Autotest 5 | include CucumberMixin 6 | end 7 | -------------------------------------------------------------------------------- /examples/ramaze/layout/default.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | Addition 4 | 5 | 6 | <%= @content %> 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/v8/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new 5 | 6 | task :default => 'cucumber' -------------------------------------------------------------------------------- /fixtures/tickets/features/step_definitons/246_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^no ([a-z]+(?: [a-z]+)*) exists in the system$/ do |resource| 2 | resource.should == "public holiday" 3 | end -------------------------------------------------------------------------------- /gem_tasks/flog.rake: -------------------------------------------------------------------------------- 1 | desc "Run flog over significant files" 2 | task :flog do 3 | sh "find lib/cucumber -name \\*.rb | grep -v parser\/feature\\.rb | xargs flog" 4 | end -------------------------------------------------------------------------------- /examples/i18n/bg/features/support/world.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | module LazyCalc 3 | def calc 4 | @calc ||= Calculator.new 5 | end 6 | end 7 | 8 | World(LazyCalc) 9 | -------------------------------------------------------------------------------- /examples/i18n/ru/features/support/world.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | module LazyCalc 3 | def calc 4 | @calc ||= Calculator.new 5 | end 6 | end 7 | 8 | World(LazyCalc) 9 | -------------------------------------------------------------------------------- /examples/i18n/uk/features/support/world.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | module LazyCalc 3 | def calc 4 | @calc ||= Calculator.new 5 | end 6 | end 7 | 8 | World(LazyCalc) 9 | -------------------------------------------------------------------------------- /examples/i18n/uz/features/support/world.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | module LazyCalc 3 | def calc 4 | @calc ||= Calculator.new 5 | end 6 | end 7 | 8 | World(LazyCalc) 9 | -------------------------------------------------------------------------------- /fixtures/json/features/background.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature with background 2 | 3 | Background: 4 | Given a passing step 5 | 6 | Scenario: 7 | Given a failing step -------------------------------------------------------------------------------- /gem_tasks/environment.rake: -------------------------------------------------------------------------------- 1 | task :ruby_env do 2 | RUBY_APP = if RUBY_PLATFORM =~ /java/ 3 | "jruby" 4 | else 5 | "ruby" 6 | end unless defined? RUBY_APP 7 | end 8 | -------------------------------------------------------------------------------- /examples/python/lib/fib.py: -------------------------------------------------------------------------------- 1 | def fib(n): 2 | result = [] 3 | a, b = 0, 1 4 | while b < n: 5 | result.append(b) 6 | a, b = b, a+b 7 | return result 8 | -------------------------------------------------------------------------------- /examples/ramaze/view/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
-------------------------------------------------------------------------------- /examples/ruby2python/lib/fib.py: -------------------------------------------------------------------------------- 1 | def fib(n): 2 | result = [] 3 | a, b = 0, 1 4 | while b < n: 5 | result.append(b) 6 | a, b = b, a+b 7 | return result 8 | -------------------------------------------------------------------------------- /examples/tcl/features/support/env.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'tcl' 3 | 4 | Before do 5 | @fib = Tcl::Interp.load_from_file(File.dirname(__FILE__) + '/../../src/fib.tcl') 6 | end 7 | -------------------------------------------------------------------------------- /fixtures/self_test/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new(:features) 5 | 6 | task :default => :features -------------------------------------------------------------------------------- /lib/autotest/cucumber_rails.rb: -------------------------------------------------------------------------------- 1 | require 'autotest/rails' 2 | require 'autotest/cucumber_mixin' 3 | 4 | class Autotest::CucumberRails < Autotest::Rails 5 | include CucumberMixin 6 | end 7 | -------------------------------------------------------------------------------- /lib/autotest/cucumber_rspec.rb: -------------------------------------------------------------------------------- 1 | require 'autotest/cucumber_mixin' 2 | require 'autotest/rspec' 3 | 4 | class Autotest::CucumberRspec < Autotest::Rspec 5 | include CucumberMixin 6 | end 7 | -------------------------------------------------------------------------------- /examples/tcl/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /legacy_features/simplest.feature: -------------------------------------------------------------------------------- 1 | Feature: Sample 2 | 3 | Background: 4 | Given this step works 5 | 6 | Scenario: Run a good step 7 | Given this step works 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /lib/autotest/cucumber_rspec2.rb: -------------------------------------------------------------------------------- 1 | require 'autotest/cucumber_mixin' 2 | require 'autotest/rspec2' 3 | 4 | class Autotest::CucumberRspec2 < Autotest::Rspec2 5 | include CucumberMixin 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/ar/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/ca/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/da/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/de/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/en/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/eo/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/es/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/et/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/fr/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/id/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/it/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/ko/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/lv/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/no/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/pt/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/ru/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/sk/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/sv/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/tr/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/uk/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/uz/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/ramaze/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/sinatra/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/test_unit/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /legacy_features/support/env.rb.simplest: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | class SomeException < Exception; end 4 | 5 | Before do 6 | raise SomeException.new("I cannot even start this scenario") 7 | end 8 | -------------------------------------------------------------------------------- /examples/i18n/bg/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/en-lol/lib/belly.rb: -------------------------------------------------------------------------------- 1 | class Belly 2 | attr_reader :cukes 3 | 4 | def initialize 5 | @cukes = 0 6 | end 7 | 8 | def eat(cukes) 9 | @cukes += cukes 10 | end 11 | end -------------------------------------------------------------------------------- /examples/i18n/fi/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/he/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/hu/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/ja/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/lt/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/pl/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/ro/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/sr-Cyrl/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /examples/i18n/sr-Latn/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end -------------------------------------------------------------------------------- /gem_tasks/sass.rake: -------------------------------------------------------------------------------- 1 | desc 'Generate the css for the html formatter from sass' 2 | task :sass do 3 | sh 'sass -t expanded lib/cucumber/formatter/cucumber.sass > lib/cucumber/formatter/cucumber.css' 4 | end -------------------------------------------------------------------------------- /fixtures/steps_library/features/step_definitions/steps_lib2.rb: -------------------------------------------------------------------------------- 1 | Given /^I defined a step 4$/ do 2 | end 3 | 4 | When /^I create a step 5$/ do 5 | end 6 | 7 | Then /^I should be too tired for step 6$/ do 8 | end -------------------------------------------------------------------------------- /lib/autotest/cucumber_rails_rspec.rb: -------------------------------------------------------------------------------- 1 | require 'autotest/cucumber_mixin' 2 | require 'autotest/rails_rspec' 3 | 4 | class Autotest::CucumberRailsRspec < Autotest::RailsRspec 5 | include CucumberMixin 6 | end 7 | -------------------------------------------------------------------------------- /lib/cucumber/core_ext/string.rb: -------------------------------------------------------------------------------- 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 | end 10 | -------------------------------------------------------------------------------- /examples/i18n/pt/lib/calculadora.rb: -------------------------------------------------------------------------------- 1 | class Calculadora 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def soma 8 | @args.inject(0) {|n,sum| sum+n} 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /examples/i18n/zh-CN/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /fixtures/steps_library/features/step_definitions/steps_lib1.rb: -------------------------------------------------------------------------------- 1 | Given /^I defined a first step$/ do 2 | end 3 | 4 | When /^I define a second step$/ do 5 | end 6 | 7 | Then /^I should also have a third step$/ do 8 | end -------------------------------------------------------------------------------- /lib/autotest/cucumber_rails_rspec2.rb: -------------------------------------------------------------------------------- 1 | require 'autotest/cucumber_mixin' 2 | require 'autotest/rails_rspec2' 3 | 4 | class Autotest::CucumberRailsRspec2 < Autotest::RailsRspec2 5 | include CucumberMixin 6 | end 7 | -------------------------------------------------------------------------------- /examples/tcl/README.textile: -------------------------------------------------------------------------------- 1 | h1. Cucumber goes Tcl 2 | 3 | h2. Prerequisites 4 | 5 | Install the ruby-tcl bindings: 6 | 7 | [sudo] gem install tcl 8 | 9 | h2. Run the example: 10 | 11 | rake cucumber 12 | -------------------------------------------------------------------------------- /examples/i18n/fr/lib/calculatrice.rb: -------------------------------------------------------------------------------- 1 | class Calculatrice 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def additionner 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /examples/i18n/ja/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: ja 2 | フィーチャ: 除算 3 | バカな間違いを避けるために 4 | 有理数も計算できること 5 | 6 | シナリオ: ふつうの数値 7 | 前提 3 を入力 8 | かつ 2 を入力 9 | もし divide を押した 10 | ならば 1.5 を表示 11 | -------------------------------------------------------------------------------- /examples/i18n/sr-Cyrl/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | 3 | def push(n) 4 | @args ||= [] 5 | @args << n 6 | end 7 | 8 | def add 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | 12 | end -------------------------------------------------------------------------------- /examples/i18n/sr-Latn/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | 3 | def push(n) 4 | @args ||= [] 5 | @args << n 6 | end 7 | 8 | def add 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | 12 | end -------------------------------------------------------------------------------- /fixtures/tickets/features/around_timeout.feature: -------------------------------------------------------------------------------- 1 | Feature: Be fast 2 | 3 | @fast 4 | Scenario: Fail if too slow 5 | # This will start failing if we change the number above 0.5 6 | When I take 0.2 seconds to complete -------------------------------------------------------------------------------- /fixtures/tickets/features/gherkin_67.feature: -------------------------------------------------------------------------------- 1 | Feature: 2 | @wip 3 | Scenario Outline: 4 | When blah 5 | 6 | Examples: 7 | | a | 8 | | b | 9 | | c | 10 | 11 | Scenario: 12 | When blah -------------------------------------------------------------------------------- /examples/i18n/ar/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | class Calculator 3 | def push(n) 4 | @args ||= [] 5 | @args << n 6 | end 7 | 8 | def جمع 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | end -------------------------------------------------------------------------------- /lib/cucumber/step_argument.rb: -------------------------------------------------------------------------------- 1 | module Cucumber 2 | class StepArgument 3 | attr_reader :val, :byte_offset 4 | 5 | def initialize(val, byte_offset) 6 | @val, @byte_offset = val, byte_offset 7 | end 8 | end 9 | end -------------------------------------------------------------------------------- /examples/i18n/en-lol/lib/basket.rb: -------------------------------------------------------------------------------- 1 | class Basket 2 | attr_reader :cukes 3 | 4 | def initialize(cukes) 5 | @cukes = cukes 6 | end 7 | 8 | def take(cukes) 9 | @cukes -= cukes 10 | cukes 11 | end 12 | end -------------------------------------------------------------------------------- /examples/i18n/no/lib/kalkulator.rb: -------------------------------------------------------------------------------- 1 | class Kalkulator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | #@args[0] + @args[1] 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | end -------------------------------------------------------------------------------- /examples/i18n/sv/lib/kalkulator.rb: -------------------------------------------------------------------------------- 1 | class Kalkulator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | #@args[0] + @args[1] 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | end -------------------------------------------------------------------------------- /fixtures/junit/features/step_definitions/steps.rb: -------------------------------------------------------------------------------- 1 | Given /a passing scenario/ do 2 | #does nothing 3 | end 4 | 5 | Given /a failing scenario/ do 6 | fail 7 | end 8 | 9 | Given /a pending step/ do 10 | pending 11 | end 12 | -------------------------------------------------------------------------------- /gem_tasks/rspec.rake: -------------------------------------------------------------------------------- 1 | require 'rspec/core/rake_task' 2 | 3 | desc "Run RSpec" 4 | RSpec::Core::RakeTask.new do |t| 5 | t.rcov = ENV['RCOV'] 6 | t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/} 7 | t.verbose = true 8 | end 9 | -------------------------------------------------------------------------------- /examples/i18n/it/lib/calcolatrice.rb: -------------------------------------------------------------------------------- 1 | class Calcolatrice 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | #@args[0] + @args[1] 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | end -------------------------------------------------------------------------------- /examples/i18n/ro/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | #@args[0] + @args[1] 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /examples/i18n/da/lib/lommeregner.rb: -------------------------------------------------------------------------------- 1 | class Lommeregner 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | #@args[0] + @args[1] 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /fixtures/junit/features/one_passing_one_failing.feature: -------------------------------------------------------------------------------- 1 | Feature: One passing scenario, one failing scenario 2 | 3 | Scenario: Passing 4 | Given a passing scenario 5 | 6 | Scenario: Failing 7 | Given a failing scenario 8 | 9 | -------------------------------------------------------------------------------- /examples/i18n/zh-TW/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: zh-TW 2 | 功能: 除法 3 | 為了避免愚蠢的錯誤 4 | 收銀機必須要能夠計算除法 5 | 而且必需能顯示非整數的結果 6 | 7 | 場景: 將兩個數相除 8 | 假設我已經在計算機上輸入 3 9 | 而且我已經在計算機上輸入 2 10 | 當我按下 divide 11 | 那麼螢幕上應該顯示 1.5 12 | -------------------------------------------------------------------------------- /fixtures/json/features/one_passing_one_failing.feature: -------------------------------------------------------------------------------- 1 | @a 2 | Feature: One passing scenario, one failing scenario 3 | 4 | @b 5 | Scenario: Passing 6 | Given a passing step 7 | 8 | @c 9 | Scenario: Failing 10 | Given a failing step 11 | 12 | -------------------------------------------------------------------------------- /fixtures/tickets/features/301/filter_background_tagged_hooks.feature: -------------------------------------------------------------------------------- 1 | Feature: https://rspec.lighthouseapp.com/projects/16211/tickets/301 2 | Background: A background 3 | Given whatever 4 | 5 | Scenario: VB is not cool 6 | Then VB should not be cool -------------------------------------------------------------------------------- /examples/i18n/bg/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculator' 6 | -------------------------------------------------------------------------------- /examples/i18n/en-lol/features/stuffing.feature: -------------------------------------------------------------------------------- 1 | # language: en-lol 2 | OH HAI: STUFFING 3 | 4 | MISHUN: CUCUMBR 5 | I CAN HAZ IN TEH BEGINNIN 3 CUCUMBRZ 6 | WEN I EAT 2 CUCUMBRZ 7 | DEN I HAS 2 CUCUMBERZ IN MAH BELLY 8 | AN IN TEH END 1 CUCUMBRZ KTHXBAI -------------------------------------------------------------------------------- /examples/i18n/pl/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculator' 6 | -------------------------------------------------------------------------------- /examples/i18n/ru/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculator' 6 | -------------------------------------------------------------------------------- /examples/i18n/uk/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculator' 6 | -------------------------------------------------------------------------------- /examples/i18n/uz/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculator' 6 | -------------------------------------------------------------------------------- /lib/cucumber/py_support/py_dsl.py: -------------------------------------------------------------------------------- 1 | import py_language 2 | 3 | class Given(object): 4 | def __init__(self, regexp): 5 | self.regexp = regexp 6 | 7 | def __call__(self, f): 8 | py_language.register_step_def(self.regexp, f) 9 | return f 10 | -------------------------------------------------------------------------------- /examples/i18n/fi/lib/laskin.rb: -------------------------------------------------------------------------------- 1 | class Laskin 2 | def pinoa(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def summaa 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def jaa 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /examples/i18n/fr/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculatrice' 6 | -------------------------------------------------------------------------------- /examples/i18n/ja/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculator' 6 | -------------------------------------------------------------------------------- /examples/i18n/ko/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: ko 2 | 기능: 나눗셈 3 | 예기치못한 실수을 방지하기 위해 4 | 분수를 계산 능력 요구한다 5 | 6 | 시나리오: 보통 숫자 7 | 조건 계산기에 3을 입력했음 8 | 그리고 계산기에 2을 입력했음 9 | 만일 내가 divide를 누르면 10 | 그러면 화면에 출력된 결과는 1.5이다 11 | 12 | -------------------------------------------------------------------------------- /examples/i18n/pt/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculadora' 6 | -------------------------------------------------------------------------------- /examples/tcl/features/step_definitions/fib_steps.rb: -------------------------------------------------------------------------------- 1 | When /^I ask Tcl to calculate fibonacci for (\d+)$/ do |n| 2 | @fib_result = @fib.eval("fib #{n}").to_i 3 | end 4 | 5 | Then /^it should give me (\d+)$/ do |expected| 6 | @fib_result.should == expected.to_i 7 | end 8 | -------------------------------------------------------------------------------- /fixtures/tickets/features/180.feature: -------------------------------------------------------------------------------- 1 | Feature: Cucumber command line 2 | In order to write better software 3 | Developers should be able to execute requirements as tests 4 | 5 | 6 | Scenario: Pending Scenario at the end of a file with whitespace after it 7 | 8 | -------------------------------------------------------------------------------- /examples/i18n/de/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/en/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/eo/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/es/lib/calculador.rb: -------------------------------------------------------------------------------- 1 | class Calculador 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/id/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/ja/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/ko/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/lv/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/no/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | 5 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 6 | require 'kalkulator' 7 | -------------------------------------------------------------------------------- /examples/i18n/sk/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/sr-Cyrl/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 3 | require 'cucumber/formatter/unicode' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 5 | require 'calculator' 6 | -------------------------------------------------------------------------------- /fixtures/self_test/README.textile: -------------------------------------------------------------------------------- 1 | h1. Self Test 2 | 3 | Cucumber's own features (ROOT_DIR/features) run the features in this directory and look at the output. 4 | 5 | Note that several of these fail intentionally. The purpose is to verify actual output against expected 6 | output. -------------------------------------------------------------------------------- /fixtures/tickets/features/229/tagged_hooks.feature: -------------------------------------------------------------------------------- 1 | Feature: Tagged hooks 2 | In order to provide more flexible setups 3 | I should be able to specify exactly 4 | where hooks are executed 5 | 6 | @i_am_so_special 7 | Scenario: Yes I am 8 | When special me goes to town -------------------------------------------------------------------------------- /fixtures/tickets/features/step_definitons/around_timeout_steps.rb: -------------------------------------------------------------------------------- 1 | Around('@fast') do |scenario, block| 2 | Timeout.timeout(0.5) do 3 | block.call 4 | end 5 | end 6 | 7 | When /^I take (.+) seconds to complete$/ do |seconds| 8 | sleep seconds.to_f 9 | end 10 | -------------------------------------------------------------------------------- /lib/cucumber/py_support/py_language.py: -------------------------------------------------------------------------------- 1 | import py_dsl 2 | 3 | step_defs = {} 4 | 5 | def register_step_def(regexp, f): 6 | print "Got a step def: ", regexp 7 | step_defs[regexp] = f 8 | 9 | def step_matches(step_name, name_to_report): 10 | print "WTF: " + step_name -------------------------------------------------------------------------------- /examples/i18n/hu/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /examples/i18n/lt/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /examples/i18n/pl/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def dodaj 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def podziel 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/i18n/zh-TW/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | class Calculator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def add 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def divide 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end -------------------------------------------------------------------------------- /examples/ruby2python/features/step_definitions/fib_steps.rb: -------------------------------------------------------------------------------- 1 | When /^I ask python to calculate fibonacci up to (\d+)$/ do |n| 2 | @fib_result = @fib.fib(n.to_i) 3 | end 4 | 5 | Then /^it should give me (\[.*\])$/ do |expected| 6 | @fib_result.inspect.should == expected 7 | end 8 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['CUCUMBER_COLORS']=nil 2 | $:.unshift(File.dirname(__FILE__) + '/../lib') 3 | $:.unshift(File.dirname(__FILE__)) 4 | 5 | require 'rubygems' 6 | require 'bundler' 7 | Bundler.setup 8 | 9 | require 'cucumber' 10 | $KCODE='u' unless Cucumber::RUBY_1_9 11 | -------------------------------------------------------------------------------- /examples/i18n/ca/lib/calculadora.rb: -------------------------------------------------------------------------------- 1 | class Calculadora 2 | 3 | def push(n) 4 | @args ||= [] 5 | @args << n 6 | end 7 | 8 | def add 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | 12 | def divide 13 | @args[0].to_f / @args[1].to_f 14 | end 15 | 16 | end -------------------------------------------------------------------------------- /examples/i18n/et/lib/kalkulaator.rb: -------------------------------------------------------------------------------- 1 | class Kalkulaator 2 | def push(n) 3 | @args ||= [] 4 | @args << n 5 | end 6 | 7 | def liida 8 | @args.inject(0){|n,sum| sum+=n} 9 | end 10 | 11 | def jaga 12 | @args[0].to_f / @args[1].to_f 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /examples/python/README.textile: -------------------------------------------------------------------------------- 1 | h1. WARNING - Experimental 2 | 3 | The Python support is experimental. Don't expect it to work. 4 | Please help fix it or head over to a more mature library: 5 | 6 | * http://github.com/gabrielfalcao/lettuce/ 7 | * http://wiki.github.com/heynemann/pyccuracy/ -------------------------------------------------------------------------------- /examples/sinatra/app.rb: -------------------------------------------------------------------------------- 1 | begin 2 | require 'sinatra' 3 | rescue LoadError 4 | require 'rubygems' 5 | require 'sinatra' 6 | end 7 | 8 | get '/add' do 9 | erb :add 10 | end 11 | 12 | post '/add' do 13 | "Answer: #{params[:first].to_i + params[:second].to_i}" 14 | end 15 | -------------------------------------------------------------------------------- /fixtures/self_test/features/lots_of_undefined.feature: -------------------------------------------------------------------------------- 1 | Feature: Lots of undefined 2 | 3 | Scenario: Implement me 4 | Given it snows in Sahara 5 | Given it's 40 degrees in Norway 6 | And it's 40 degrees in Norway 7 | When I stop procrastinating 8 | And there is world peace -------------------------------------------------------------------------------- /fixtures/self_test/features/undefined_multiline_args.feature: -------------------------------------------------------------------------------- 1 | Feature: undefined multiline args 2 | 3 | Scenario: pystring 4 | Given a pystring 5 | """ 6 | example 7 | """ 8 | 9 | Scenario: table 10 | Given a table 11 | | table | 12 | |example| -------------------------------------------------------------------------------- /fixtures/tickets/features/246.feature: -------------------------------------------------------------------------------- 1 | Feature: https://rspec.lighthouseapp.com/projects/16211/tickets/246-distorted-console-output-for-slightly-complicated-step-regexp-match 2 | 3 | Scenario: See "No Record(s) Found" for Zero Existing 4 | Given no public holiday exists in the system 5 | -------------------------------------------------------------------------------- /examples/i18n/en-lol/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | require 'cucumber/formatter/unicode' 3 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 4 | 5 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 6 | require 'basket' 7 | require 'belly' 8 | -------------------------------------------------------------------------------- /examples/ruby2python/README.textile: -------------------------------------------------------------------------------- 1 | h1. WARNING - Experimental 2 | 3 | The Python support is experimental. Don't expect it to work. 4 | Please help fix it or head over to a more mature library: 5 | 6 | * http://github.com/gabrielfalcao/lettuce/ 7 | * http://wiki.github.com/heynemann/pyccuracy/ -------------------------------------------------------------------------------- /lib/autotest/discover.rb: -------------------------------------------------------------------------------- 1 | Autotest.add_discovery do 2 | if File.directory?('features') 3 | if ENV['AUTOFEATURE'] =~ /true/i 4 | "cucumber" 5 | else 6 | puts "(Not running features. To run features in autotest, set AUTOFEATURE=true.)" 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /examples/i18n/he/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | class Calculator 3 | def push(n) 4 | @args ||= [] 5 | @args << n 6 | end 7 | 8 | def חבר 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | 12 | def חלק 13 | @args[0].to_f / @args[1].to_f 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /examples/sinatra/views/add.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /lib/cucumber/formatter/stepdefs.rb: -------------------------------------------------------------------------------- 1 | require 'cucumber/formatter/usage' 2 | 3 | module Cucumber 4 | module Formatter 5 | class Stepdefs < Usage 6 | def print_steps(stepdef_key) 7 | end 8 | 9 | def max_step_length 10 | 0 11 | end 12 | end 13 | end 14 | end -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | Gemfile.lock 3 | nbproject 4 | coverage 5 | pkg 6 | doc 7 | tmp 8 | .yardoc 9 | *.log 10 | *.pid 11 | .eprj 12 | .tmtags 13 | *~ 14 | .DS_Store 15 | *.swp 16 | target 17 | *.tmproj 18 | .#* 19 | .idea 20 | *.pyc 21 | *.rbc 22 | rerun.txt 23 | ._* 24 | .rvmrc 25 | .sass-cache 26 | -------------------------------------------------------------------------------- /examples/i18n/tr/lib/hesap_makinesi.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | class HesapMakinesi 3 | def push(n) 4 | @args ||= [] 5 | @args << n 6 | end 7 | 8 | def topla 9 | @args.inject(0){|n,sum| sum+=n} 10 | end 11 | 12 | def böl 13 | @args[0].to_f / @args[1].to_f 14 | end 15 | end -------------------------------------------------------------------------------- /examples/rspec_doubles/features/mocking.feature: -------------------------------------------------------------------------------- 1 | Feature: Mocking 2 | In order to test external stuff 3 | I want to mock 4 | 5 | Scenario: Mock a transmogrifier 6 | Given I have a cardboard box 7 | # Comment out the next line to see a failure 8 | When I poke it all is good 9 | 10 | -------------------------------------------------------------------------------- /fixtures/self_test/features/call_undefined_step_from_step_def.feature: -------------------------------------------------------------------------------- 1 | Feature: Calling undefined step 2 | 3 | Scenario: Call directly 4 | Given a step definition that calls an undefined step 5 | 6 | Scenario: Call via another 7 | Given call step "a step definition that calls an undefined step" -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | require 'rubygems' 3 | require 'bundler' 4 | Bundler.setup 5 | Bundler::GemHelper.install_tasks 6 | 7 | Dir['gem_tasks/**/*.rake'].each { |rake| load rake } 8 | 9 | task :default => [:spec, :cucumber] 10 | 11 | require 'rake/clean' 12 | CLEAN.include %w(**/*.{log,pyc,rbc}) 13 | -------------------------------------------------------------------------------- /fixtures/tickets/features/279/wrong.feature_: -------------------------------------------------------------------------------- 1 | Feature: pystring indentaion testcase 2 | 3 | Scenario: example of wrong indentation 4 | Given multiline string 5 | 6 | 7 | 8 | """ 9 | I'm a cucumber and I'm ok 10 | I sleep all night and test all day 11 | """ 12 | -------------------------------------------------------------------------------- /fixtures/tickets/features/step_definitons/248_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^this is pending until we fix it$/ do 2 | pending 3 | end 4 | 5 | Given /^context with Cheese$/ do 6 | pending 7 | end 8 | 9 | When /^action$/ do 10 | pending 11 | end 12 | 13 | Then /^outcome with Pepper Jack$/ do 14 | pending 15 | end 16 | -------------------------------------------------------------------------------- /examples/i18n/he/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: he 2 | תכונה: חילוק 3 | כדי למנוע טעויות טפשיות 4 | לקופאים חייבת להיות יכולת לחשב שבר 5 | 6 | תרחיש: מספרים רגילים 7 | בהינתן שהזנתי 3 למחשבון 8 | וגם שהזנתי 2 למחשבון 9 | כאשר אני לוחץ על חלק 10 | אז התוצאה על המסך צריכה להיות 1.5 11 | -------------------------------------------------------------------------------- /examples/test_unit/features/test_unit.feature: -------------------------------------------------------------------------------- 1 | Feature: Test::Unit 2 | In order to please people who like Test::Unit 3 | As a Cucumber user 4 | I want to be able to use assert* in my step definitions 5 | 6 | Scenario: assert_equal 7 | Given x = 5 8 | And y = 5 9 | Then I can assert that x == y 10 | -------------------------------------------------------------------------------- /gem_tasks/fix_cr_lf.rake: -------------------------------------------------------------------------------- 1 | desc 'Make all files use UNIX (\n) line endings' 2 | task :fix_cr_lf do 3 | files = FileList['**/*'] 4 | files.each do |f| 5 | next if File.directory?(f) || f =~ /dos/ 6 | s = IO.read(f) 7 | s.gsub!(/\r?\n/, "\n") 8 | File.open(f, "w") { |io| io.write(s) } 9 | end 10 | end -------------------------------------------------------------------------------- /examples/i18n/eo/features/divido.feature: -------------------------------------------------------------------------------- 1 | # language: eo 2 | Trajto: Divido 3 | Por eviti stultajn erarojn 4 | Uzantoj devas havi eblecon kalkuli frakcion 5 | 6 | Scanaro: Simplaj nombroj 7 | * mi entajpis 3 en kalkulilo 8 | * mi entajpis 2 en kalkulilo 9 | * mi premis dividi 10 | * la rezulto devas esti 1.5 11 | -------------------------------------------------------------------------------- /lib/cucumber/rspec/doubles.rb: -------------------------------------------------------------------------------- 1 | require 'rspec/core' 2 | 3 | RSpec.configuration.configure_mock_framework 4 | World(RSpec::Core::MockFrameworkAdapter) 5 | 6 | Before do 7 | RSpec::Mocks::setup(self) 8 | end 9 | 10 | After do 11 | begin 12 | RSpec::Mocks::verify 13 | ensure 14 | RSpec::Mocks::teardown 15 | end 16 | end -------------------------------------------------------------------------------- /lib/cucumber/step_mother.rb: -------------------------------------------------------------------------------- 1 | require 'cucumber/runtime' 2 | 3 | module Cucumber 4 | class StepMother < Runtime 5 | def initialize(*args) 6 | warn("StepMother has been deprecated and will be gently put to sleep at the next major release. Please use Runtime instead. #{caller[0]}") 7 | super 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /examples/i18n/tr/features/bolme.feature: -------------------------------------------------------------------------------- 1 | # language: tr 2 | Özellik: Bölme 3 | Gülünç hatalardan sakınmak için 4 | Bir kasiyer sayıları bölebilmeli 5 | 6 | Senaryo: Doğal sayılar 7 | Diyelim ki hesap makinesine 3 girdim 8 | Ve hesap makinesine 2 girdim 9 | Eğer ki böl tuşuna basarsam 10 | O zaman ekrandaki sonuç 1.5 olmalı 11 | -------------------------------------------------------------------------------- /fixtures/tickets/features/270/back.feature: -------------------------------------------------------------------------------- 1 | Feature: Background 2 | In for background to work properly 3 | As a user 4 | I want it to run transactionally and only once when I call an individual scenario 5 | 6 | Background: 7 | Given plop 8 | 9 | Scenario: Barping 10 | When I barp 11 | 12 | 13 | Scenario: Wibbling 14 | When I wibble -------------------------------------------------------------------------------- /fixtures/tickets/features/301/filter_background_tagged_hooks_steps.rb: -------------------------------------------------------------------------------- 1 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 2 | 3 | Before('@nothing_has_this_tag') do 4 | @vb = :cool 5 | end 6 | 7 | Given /^whatever$/ do 8 | end 9 | 10 | Then /^VB should not be cool$/ do 11 | @vb.should_not == :cool 12 | end 13 | -------------------------------------------------------------------------------- /lib/cucumber/ast/visitor.rb: -------------------------------------------------------------------------------- 1 | module Cucumber 2 | module Ast 3 | class Visitor 4 | DEPRECATION_WARNING = "Cucumber::Ast::Visitor is deprecated and will be removed. You no longer need to inherit from this class." 5 | 6 | def initialize(step_mother) 7 | raise(DEPRECATION_WARNING) 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/cucumber/broadcaster.rb: -------------------------------------------------------------------------------- 1 | module Cucumber 2 | class Broadcaster #:nodoc: 3 | def initialize(receivers = []) 4 | @receivers = receivers 5 | end 6 | 7 | def method_missing(method_name, *args) 8 | @receivers.map do |receiver| 9 | receiver.__send__(method_name, *args) 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /examples/i18n/uz/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: uz 2 | Функционал: Сонларни кушиш 3 | Хаелда кушмаслик учун 4 | Купчилик сонларни атомат равищда кушишни истайди 5 | 6 | Сценарий: Икки бутун сонни кушиш 7 | Агар 50 сонини киритсам 8 | Ва ундан сунг 70 сонини киритсам 9 | Агар "+" боссам 10 | Унда жавоб 120 сони булиши керак 11 | -------------------------------------------------------------------------------- /fixtures/tickets/features/270/back.steps.rb: -------------------------------------------------------------------------------- 1 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 2 | 3 | Given /^plop$/ do 4 | raise "Only one plop!" if @plop 5 | @plop = true 6 | end 7 | 8 | When /^I barp$/ do 9 | @plop.should == true 10 | end 11 | 12 | When /^I wibble$/ do 13 | @plop.should == true 14 | end -------------------------------------------------------------------------------- /examples/i18n/it/features/somma.feature: -------------------------------------------------------------------------------- 1 | # language: it 2 | Funzionalità: somma 3 | Per evitare di fare errori stupidi 4 | Come utente 5 | Voglio sapere la somma di due numeri 6 | 7 | Scenario: la somma di due numeri 8 | Dato che ho inserito 5 9 | E che ho inserito 7 10 | Quando premo somma 11 | Allora il risultato deve essere 12 12 | -------------------------------------------------------------------------------- /examples/i18n/sk/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: sk 2 | Požiadavka: Delenie 3 | Aby som sa vyhol hlúpym chybám 4 | Pokladníci musia vedieť vypočítať podiel 5 | 6 | Scenár: Prirodzené čísla 7 | Pokiaľ Zadám číslo 3 do kalkulačky 8 | A Zadám číslo 2 do kalkulačky 9 | Keď Stlačím tlačidlo divide 10 | Tak Výsledok by mal byť 1.5 11 | -------------------------------------------------------------------------------- /fixtures/json/features/tables.feature: -------------------------------------------------------------------------------- 1 | Feature: A scenario outline 2 | 3 | Scenario Outline: 4 | Given I add and 5 | When I pass a table argument 6 | | foo | bar | 7 | | bar | baz | 8 | Then I the result should be 9 | 10 | Examples: 11 | | a | b | c | 12 | | 1 | 2 | 3 | 13 | | 2 | 3 | 4 | -------------------------------------------------------------------------------- /fixtures/tickets/features/248.feature: -------------------------------------------------------------------------------- 1 | Feature: pending method causes failure in Scenario Outlines 2 | 3 | Scenario Outline: blah 4 | Given this is pending until we fix it 5 | Given context with 6 | When action 7 | Then outcome with 8 | 9 | Examples: 10 | | Stuff | Blah | 11 | | Cheese | Pepper Jack | 12 | -------------------------------------------------------------------------------- /fixtures/tickets/features/half_manual.feature: -------------------------------------------------------------------------------- 1 | @ask 2 | Feature: Half manual 3 | In order to speed up manual tests 4 | Testers should at least be able to automate parts of it 5 | 6 | Scenario: Check mailbox 7 | Given I have signed up on the web 8 | When I check my mailbox 9 | Then I should have an email containing "cukes" 10 | 11 | 12 | -------------------------------------------------------------------------------- /lib/cucumber/formatter/json_pretty.rb: -------------------------------------------------------------------------------- 1 | require 'cucumber/formatter/json' 2 | 3 | module Cucumber 4 | module Formatter 5 | # The formatter used for --format json_pretty 6 | class JsonPretty < Json 7 | def after_features(features) 8 | @io.write(JSON.pretty_generate(@obj)) 9 | end 10 | end 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /examples/i18n/lt/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: lt 2 | Savybė: Dalyba 3 | Norint išvengti klaidų 4 | Kasininkai privalo mokėti skaičiuoti trupmenas 5 | 6 | Scenarijus: Realieji skaičiai 7 | Duota aš įvedžiau 3 į skaičiuotuvą 8 | Ir aš įvedžiau 2 į skaičiuotuvą 9 | Kai aš paspaudžiu "divide" 10 | Tada rezultatas ekrane turi būti 1.5 11 | -------------------------------------------------------------------------------- /examples/watir/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = %w{--format pretty} 6 | end 7 | 8 | Cucumber::Rake::Task.new(:cucumber_screenshot) do |t| 9 | t.cucumber_opts = %w{--format html --out report.html} 10 | end 11 | 12 | task :default => :cucumber -------------------------------------------------------------------------------- /examples/watir/features/search.feature: -------------------------------------------------------------------------------- 1 | Feature: Search 2 | In order to learn more 3 | As an information seeker 4 | I want to find more information 5 | 6 | Scenario: Find what I'm looking for 7 | Given I am on the Google search page 8 | When I search for "cucumber github" 9 | Then I should see 10 | """ 11 | GitHub 12 | """ 13 | -------------------------------------------------------------------------------- /examples/i18n/id/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: id 2 | Fitur: Division 3 | Untuk hindari kesalahan konyol 4 | Kasir harus dapat menghitung pembagian 5 | 6 | Skenario: bilangan biasa 7 | Dengan aku sudah masukkan 3 ke kalkulator 8 | Dan aku sudah masukkan 2 ke kalkulator 9 | Ketika aku tekan divide 10 | Maka hasilnya harus 1.5 di layar 11 | -------------------------------------------------------------------------------- /examples/i18n/lv/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: lv 2 | Funkcionalitāte: Dalīšana 3 | Lai izvairītos no muļķīgām kļūdām 4 | Kasieriem ir jāprot aprēķināt daļas 5 | 6 | Scenārijs: Veseli skaitļi 7 | Kad esmu ievadījis kalkulatorā 3 8 | Un esmu ievadījis kalkulatorā 2 9 | Ja nospiežu pogu divide 10 | Tad rezultātam uz ekrāna ir jābūt 1.5 11 | -------------------------------------------------------------------------------- /fixtures/tickets/features/step_definitons/half_manual_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^I have signed up on the web$/ do 2 | # just pretend we do 3 | end 4 | 5 | When /^I check my mailbox$/ do 6 | @answer = ask("What's in your mailbox? ", 3) 7 | end 8 | 9 | Then /^I should have an email containing "([^"]*)"$/ do |content| 10 | @answer.should =~ Regexp.new(content) 11 | end 12 | -------------------------------------------------------------------------------- /examples/i18n/zh-CN/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: zh-CN 2 | 功能:加法 3 | 为了避免一些愚蠢的错误 4 | 作为一个数学白痴 5 | 我希望有人告诉我数字相加的结果 6 | 7 | 场景: 两个数相加 8 | 假如我已经在计算器里输入6 9 | 而且我已经在计算器里输入7 10 | 当我按相加按钮 11 | 那么我应该在屏幕上看到的结果是13 12 | 13 | 场景: 三个数相加 14 | 假如我已经在计算器里输入6 15 | 而且我已经在计算器里输入7 16 | 而且我已经在计算器里输入1 17 | 当我按相加按钮 18 | 那么我应该在屏幕上看到的结果是14 19 | -------------------------------------------------------------------------------- /fixtures/self_test/features/tags_sample.feature: -------------------------------------------------------------------------------- 1 | @sample_one 2 | Feature: Tag samples 3 | 4 | @sample_two @sample_four 5 | Scenario: Passing 6 | Given missing 7 | 8 | @sample_three 9 | Scenario Outline: 10 | Given 11 | Examples: 12 | |state| 13 | |missing| 14 | 15 | @sample_three @sample_four 16 | Scenario: Skipped 17 | Given missing -------------------------------------------------------------------------------- /examples/i18n/en/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: en 2 | Feature: Division 3 | In order to avoid silly mistakes 4 | Cashiers must be able to calculate a fraction 5 | 6 | Scenario: Regular numbers 7 | * I have entered 3 into the calculator 8 | * I have entered 2 into the calculator 9 | * I press divide 10 | * the result should be 1.5 on the screen 11 | -------------------------------------------------------------------------------- /examples/i18n/ja/features/step_definitons/calculator_steps.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | Before do 3 | @calc = Calculator.new 4 | end 5 | 6 | After do 7 | end 8 | 9 | 前提 "$n を入力" do |n| 10 | @calc.push n.to_i 11 | end 12 | 13 | もし /(\w+) を押した/ do |op| 14 | @result = @calc.send op 15 | end 16 | 17 | ならば /(.*) を表示/ do |result| 18 | @result.should == result.to_f 19 | end 20 | -------------------------------------------------------------------------------- /examples/i18n/ru/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: ru 2 | Функционал: Сложение чисел 3 | Чтобы не складывать в уме 4 | Все, у кого с этим туго 5 | Хотят автоматическое сложение целых чисел 6 | 7 | Сценарий: Сложение двух целых чисел 8 | Допустим я ввожу число 50 9 | И затем ввожу число 70 10 | Если я нажимаю "+" 11 | То результатом должно быть число 120 -------------------------------------------------------------------------------- /examples/i18n/bg/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: bg 2 | Функционалност: Събиране на числа 3 | За да не го правят наум 4 | Потребителите 5 | Трябва да могат да събират числа с калкулатора 6 | 7 | Сценарий: Събиране на две цели числа 8 | Дадено е че съм въвел 50 9 | И съм въвел 70 10 | Когато натисна "+" 11 | То резултата трябва да е равен на 120 12 | 13 | -------------------------------------------------------------------------------- /examples/i18n/hu/features/osztas.feature: -------------------------------------------------------------------------------- 1 | # language: hu 2 | Jellemző: Osztás 3 | Azért, hogy elkerüljem a buta hibákat 4 | a számológépeknek tudniuk kell osztani. 5 | 6 | Forgatókönyv: Egyszerű számok 7 | Amennyiben beütök a számológépbe egy 3-ast 8 | És beütök a számológépbe egy 2-est 9 | Ha megnyomom a divide gombot 10 | Akkor eredményül 1.5-öt kell kapnom 11 | -------------------------------------------------------------------------------- /examples/i18n/no/features/step_definitons/kalkulator_steps.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | Before do 4 | @calc = Kalkulator.new 5 | end 6 | 7 | Given /at jeg har tastet inn (\d+)/ do |n| 8 | @calc.push n.to_i 9 | end 10 | 11 | Når 'jeg summerer' do 12 | @result = @calc.add 13 | end 14 | 15 | Så /skal resultatet være (\d*)/ do |result| 16 | @result.should == result.to_i 17 | end 18 | -------------------------------------------------------------------------------- /examples/i18n/pl/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: pl 2 | Właściwość: Dzielenie 3 | W celu uniknięcia głupich błędów 4 | Kasjer musi znać się na ułamkach 5 | 6 | Scenariusz: Zwykłe liczby 7 | Zakładając wprowadzenie do kalkulatora liczby 3 8 | Oraz wprowadzenie do kalkulatora liczby 2 9 | Jeżeli nacisnę podziel 10 | Wtedy rezultat 1.5 wyświetli się na ekranie 11 | -------------------------------------------------------------------------------- /examples/python/features/step_definitions/fib_steps.py: -------------------------------------------------------------------------------- 1 | from py_dsl import * 2 | 3 | @Given("^I ask python to calculate fibonacci up to (\d+)$") 4 | def calc_fib_upto(n): 5 | print("CALCULATING FIB") 6 | #self.fib_result = fib.fib(n.to_i) 7 | 8 | @Given("^it should give me (\[.*\])$") 9 | def fib_should_be(n): 10 | print("COMPARING FIB") 11 | #self.fib_result = fib.fib(n.to_i) -------------------------------------------------------------------------------- /examples/ramaze/features/add.feature: -------------------------------------------------------------------------------- 1 | Feature: Addition 2 | In order to avoid silly mistakes 3 | As a math idiot 4 | I want to be told the sum of two numbers 5 | 6 | Scenario: Add two numbers 7 | Given I visit the calculator page 8 | And I fill in '50' for 'first' 9 | And I fill in '70' for 'second' 10 | When I press 'Add' 11 | Then I should see 'Answer: 120' 12 | -------------------------------------------------------------------------------- /examples/sinatra/features/add.feature: -------------------------------------------------------------------------------- 1 | Feature: Addition 2 | In order to avoid silly mistakes 3 | As a math idiot 4 | I want to be told the sum of two numbers 5 | 6 | Scenario: Add two numbers 7 | Given I visit the calculator page 8 | And I fill in '50' for 'first' 9 | And I fill in '70' for 'Second' 10 | When I press 'Add' 11 | Then I should see 'Answer: 120' 12 | -------------------------------------------------------------------------------- /examples/i18n/et/features/jagamine.feature: -------------------------------------------------------------------------------- 1 | # language: et 2 | Omadus: Jagamine 3 | Rumalate vigade vältimiseks 4 | Peavad kassapidajad saama arvutada murdudes 5 | 6 | Stsenaarium: Tavalised numbrid 7 | Eeldades et olen sisestanud kalkulaatorisse numbri 3 8 | Ja olen sisestanud kalkulaatorisse numbri 2 9 | Kui ma vajutan jaga 10 | Siis vastuseks peab ekraanil kuvatama 1.5 11 | -------------------------------------------------------------------------------- /examples/i18n/ro/features/adunare.feature: -------------------------------------------------------------------------------- 1 | # language: ro 2 | Funcţionalitate: Adunare 3 | Pentru a evita erorile stupide 4 | Ca persoană fără talent la aritmetică 5 | Vreau să pot face adunări exacte 6 | 7 | Scenariu: Suma a două numere 8 | Dat fiind un calculator 9 | Când introduc 5 10 | Şi introduc 7 11 | Şi apăs tasta Egal 12 | Atunci ecranul trebuie să afişeze 12 13 | -------------------------------------------------------------------------------- /examples/rspec_doubles/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # If you want to use a different mock framework than 2 | # RSpec-Mocks - just set configure that accordingly 3 | # 4 | # require 'rspec/core' 5 | # RSpec.configure do |c| 6 | # c.mock_framework = :rspec 7 | # c.mock_framework = :mocha 8 | # c.mock_framework = :rr 9 | # c.mock_framework = :flexmock 10 | # end 11 | 12 | require 'cucumber/rspec/doubles' -------------------------------------------------------------------------------- /examples/sinatra/README.textile: -------------------------------------------------------------------------------- 1 | h1. Sinatra and Cucumber 2 | 3 | This example will work with: 4 | 5 | * sinatra 0.9.4 6 | * rack-test 0.3.0 7 | 8 | As of this writing, the latest released webrat gem isn't compatible with these gems, so you need this: 9 | 10 | * aslakhellesoy-webrat 0.4.4.1 11 | 12 | That webrat gem is built from sr's ps2 branch: http://github.com/brynary/webrat/network 13 | 14 | -------------------------------------------------------------------------------- /fixtures/self_test/features/sample.feature: -------------------------------------------------------------------------------- 1 | # Feature comment 2 | @one 3 | Feature: Sample 4 | 5 | @two @three 6 | Scenario: Missing 7 | Given missing 8 | 9 | # Scenario comment 10 | @three 11 | Scenario: Passing 12 | Given passing 13 | |a|b| 14 | |c|d| 15 | 16 | @four 17 | Scenario: Failing 18 | Given failing 19 | """ 20 | hello 21 | """ 22 | -------------------------------------------------------------------------------- /lib/cucumber/formatter/duration.rb: -------------------------------------------------------------------------------- 1 | module Cucumber 2 | module Formatter 3 | module Duration 4 | # Helper method for formatters that need to 5 | # format a duration in seconds to the UNIX 6 | # time format. 7 | def format_duration(seconds) 8 | m, s = seconds.divmod(60) 9 | "#{m}m#{'%.3f' % s}s" 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /examples/i18n/fi/features/jakolasku.feature: -------------------------------------------------------------------------------- 1 | # language: fi 2 | Ominaisuus: Jakolasku 3 | Välttyäkseen hölmöiltä virheiltä 4 | Kassanhoitajan on voitava laskea osamäärä 5 | 6 | Tapaus: Kokonaislukujen jakolasku 7 | Oletetaan että olen syöttänyt laskimeen luvun 3 8 | Ja että olen syöttänyt laskimeen luvun 2 9 | Kun painan "jaa" 10 | Niin laskimen ruudulla pitäisi näkyä tulos 1.5 11 | -------------------------------------------------------------------------------- /examples/sinatra/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # See http://wiki.github.com/aslakhellesoy/cucumber/sinatra 2 | # for more details about Sinatra with Cucumber 3 | 4 | require File.dirname(__FILE__) + '/../../app' 5 | 6 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 7 | require 'rack/test' 8 | require 'capybara/cucumber' 9 | 10 | Capybara.app = Sinatra::Application 11 | -------------------------------------------------------------------------------- /examples/i18n/uk/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: uk 2 | Функціонал: Додавання чисел 3 | Для того щоб не додавати числа в умі 4 | Всі, хто мають з цим проблеми 5 | Хочуть автоматичного додавання цілих чисел 6 | 7 | Сценарій: Додавання двох цілих чисел 8 | Припустимо я ввожу число 50 9 | І потім ввожу число 70 10 | Якщо я натискаю "+" 11 | То результатом повинно бути число 120 12 | -------------------------------------------------------------------------------- /examples/sinatra/features/step_definitions/add_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^I visit the calculator page$/ do 2 | visit '/add' 3 | end 4 | 5 | Given /^I fill in '(.*)' for '(.*)'$/ do |value, field| 6 | fill_in(field, :with => value) 7 | end 8 | 9 | When /^I press '(.*)'$/ do |name| 10 | click_button(name) 11 | end 12 | 13 | Then /^I should see '(.*)'$/ do |text| 14 | body.should match(/#{text}/m) 15 | end 16 | -------------------------------------------------------------------------------- /fixtures/tickets/features/lib/pantry.rb: -------------------------------------------------------------------------------- 1 | class Pantry 2 | 3 | def initialize 4 | @items = {} 5 | end 6 | 7 | def add(food_name, count) 8 | @items[food_name] ||= 0 9 | @items[food_name] += count.to_i 10 | end 11 | 12 | def remove(food_name, count) 13 | @items[food_name] -= count.to_i 14 | end 15 | 16 | def count(food_name) 17 | @items[food_name] 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /examples/i18n/ja/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: ja 2 | フィーチャ: 加算 3 | バカな間違いを避けるために 4 | 数学オンチとして 5 | 2つの数の合計を知りたい 6 | 7 | シナリオテンプレート: 2つの数の加算について 8 | 前提 <値1> を入力 9 | かつ <値2> を入力 10 | もし <ボタン> を押した 11 | ならば <結果> を表示 12 | 13 | 例: 14 | | 値1 | 値2 | ボタン | 結果 | 15 | | 20 | 30 | add | 50 | 16 | | 2 | 5 | add | 7 | 17 | | 0 | 40 | add | 40 | 18 | -------------------------------------------------------------------------------- /examples/i18n/pt/features/adicao.feature: -------------------------------------------------------------------------------- 1 | # language: pt 2 | Funcionalidade: Adição 3 | Para evitar erros bobos 4 | Como um péssimo matemático 5 | Eu quero saber como somar dois números 6 | 7 | Cenário: Adicionar dois números 8 | Dado que eu digitei 50 na calculadora 9 | E que eu digitei 70 na calculadora 10 | Quando eu aperto o botão de soma 11 | Então o resultado na calculadora deve ser 120 -------------------------------------------------------------------------------- /examples/ramaze/features/step_definitions/add_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^I visit the calculator page$/ do 2 | visit '/' 3 | end 4 | 5 | Given /^I fill in '(.*)' for '(.*)'$/ do |value, field| 6 | fill_in(field, :with => value) 7 | end 8 | 9 | When /^I press '(.*)'$/ do |name| 10 | click_button(name) 11 | end 12 | 13 | Then /^I should see '(.*)'$/ do |text| 14 | response_body.should contain(/#{text}/m) 15 | end 16 | -------------------------------------------------------------------------------- /fixtures/tickets/features/229/tagged_hooks.rb: -------------------------------------------------------------------------------- 1 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 2 | 3 | Before('@i_am_so_special') do 4 | @something_special = 10 5 | end 6 | 7 | After('@i_am_so_special') do 8 | @something_special.should == 20 9 | end 10 | 11 | When /special me goes to town/ do 12 | @something_special.should == 10 13 | @something_special = 20 14 | end -------------------------------------------------------------------------------- /spec/cucumber/ast/tree_walker_spec.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') 2 | 3 | module Cucumber::Ast 4 | describe TreeWalker do 5 | it "should visit features" do 6 | tw = TreeWalker.new(nil, [mock('listener', :before_visit_features => nil)]) 7 | tw.should_not_receive(:warn) 8 | tw.visit_features(mock('features', :accept => nil)) 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /examples/i18n/zh-TW/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: zh-TW 2 | 功能: 加法 3 | 為了避免愚蠢的錯誤 4 | 作為一個數學白痴 5 | 我希望有人能告訴我兩個數相加的結果 6 | 7 | 場景大綱: 將兩個數相加 8 | 假設我已經在計算機上輸入 <數值_1> 9 | 而且我已經在計算機上輸入 <數值_2> 10 | 當我按下 <按鈕> 11 | 那麼螢幕上應該顯示 <結果> 12 | 13 | 例子: 14 | | 數值_1 | 數值_2 | 按鈕 | 結果 | 15 | | 20 | 30 | add | 50 | 16 | | 2 | 5 | add | 7 | 17 | | 0 | 40 | add | 40 | 18 | -------------------------------------------------------------------------------- /examples/ramaze/app.rb: -------------------------------------------------------------------------------- 1 | begin 2 | require 'ramaze' 3 | rescue LoadError 4 | require 'rubygems' 5 | require 'ramaze' 6 | end 7 | 8 | class Main < Ramaze::Controller 9 | engine :ERB 10 | layout :default 11 | 12 | def index 13 | # just render views/index.html.erb 14 | end 15 | 16 | def add 17 | "Answer: #{request[:first].to_i + request[:second].to_i}" 18 | end 19 | end 20 | 21 | Ramaze.start :root => __DIR__ 22 | -------------------------------------------------------------------------------- /legacy_features/html_formatter.feature: -------------------------------------------------------------------------------- 1 | @fails_on_1_9 @rspec2 2 | Feature: HTML formatter 3 | In order to make it easy to read Cucumber results 4 | there should be a HTML formatter with an awesome CSS 5 | 6 | Scenario: Everything in fixtures/self_test 7 | When I run cucumber -q --format html --out tmp/a.html features 8 | Then "fixtures/self_test/tmp/a.html" should have the same contents as "legacy_features/html_formatter/a.html" 9 | -------------------------------------------------------------------------------- /examples/i18n/de/features/division.feature: -------------------------------------------------------------------------------- 1 | # language: de 2 | Funktionalität: Division 3 | Um dumme Fehler zu vermeiden 4 | müssen Kassierer in der Lage sein einen Bruchteil zu berechnen 5 | 6 | Szenario: Normale Zahlen 7 | Gegeben sei ich habe 3 in den Taschenrechner eingegeben 8 | Und ich habe 2 in den Taschenrechner eingegeben 9 | Wenn ich divide drücke 10 | Dann sollte das Ergebniss auf dem Bildschirm 1.5 sein 11 | -------------------------------------------------------------------------------- /examples/i18n/ko/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: ko 2 | 기능: 덧셈 3 | 예기치못한 실수을 방지하기 위해 4 | 수학을 잘 못하는 사람으로써 5 | 두숫자의 합을 알고 싶다 6 | 7 | 시나리오 개요: 두 숫자를 더하기 8 | 조건 계산기에 <입력1>을 입력했음 9 | 그리고 계산기에 <입력2>을 입력했음 10 | 만일 내가 <버튼>를 누르면 11 | 그러면 화면에 출력된 결과는 <결과>이다 12 | 13 | 예: 14 | | 입력1 | 입력2 | 버튼 | 결과 | 15 | | 20 | 30 | add | 50 | 16 | | 2 | 5 | add | 7 | 17 | | 0 | 40 | add | 40 | 18 | -------------------------------------------------------------------------------- /gem_tasks/examples.rake: -------------------------------------------------------------------------------- 1 | desc 'Run all exmples' 2 | task :examples do 3 | Dir['examples/*'].each do |example_dir| 4 | next if !File.directory?(example_dir) || %w{examples/i18n examples/tcl examples/python examples/ruby2python}.index(example_dir) 5 | puts "Running #{example_dir}" 6 | Dir.chdir(example_dir) do 7 | raise "No Rakefile in #{Dir.pwd}" unless File.file?('Rakefile') 8 | sh "rake cucumber" 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /examples/i18n/sr-Cyrl/features/step_definitons/calculator_steps.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | Before do 4 | @calc = Calculator.new 5 | end 6 | 7 | After do 8 | end 9 | 10 | Задати /унесен број (\d+) у калкулатор/ do |n| 11 | @calc.push n.to_i 12 | end 13 | 14 | Када /притиснем (\w+)/ do |op| 15 | @result = @calc.send op 16 | end 17 | 18 | Онда /би требало да буде (.*) прикаѕано на екрану/ do |result| 19 | @result.should == result.to_f 20 | end 21 | -------------------------------------------------------------------------------- /examples/i18n/pt/features/step_definitions/calculadora_steps.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | Before do 4 | @calc = Calculadora.new 5 | end 6 | 7 | After do 8 | end 9 | 10 | Dado /que eu digitei (\d+) na calculadora/ do |n| 11 | @calc.push n.to_i 12 | end 13 | 14 | Quando 'eu aperto o botão de soma' do 15 | @result = @calc.soma 16 | end 17 | 18 | Então /o resultado na calculadora deve ser (\d*)/ do |result| 19 | @result.should == result.to_i 20 | end 21 | -------------------------------------------------------------------------------- /fixtures/self_test/features/outline_sample.feature: -------------------------------------------------------------------------------- 1 | Feature: Outline Sample 2 | 3 | Scenario: I have no steps 4 | 5 | Scenario Outline: Test state 6 | Given without a table 7 | Given without a table 8 | Examples: Rainbow colours 9 | | state | other_state | 10 | | missing | passing| 11 | | passing| passing | 12 | | failing | passing | 13 | Examples:Only passing 14 | | state | other_state | 15 | | passing | passing | -------------------------------------------------------------------------------- /fixtures/tickets/features/table_diffing.feature: -------------------------------------------------------------------------------- 1 | @intentional_failure 2 | Feature: Tables 3 | Scenario: Extra row with table 4 | Then the table should be different with table: 5 | | a | b | 6 | | one | two | 7 | | three | four | 8 | 9 | Scenario: Extra row and missing column with table 10 | Then the table should be different with table: 11 | | a | e | b | 12 | | one | Q | two | 13 | | three | R | four | 14 | -------------------------------------------------------------------------------- /examples/i18n/bg/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | class Calculator 4 | def initialize 5 | @stack = [] 6 | end 7 | 8 | def push(arg) 9 | @stack.push arg 10 | end 11 | 12 | def result 13 | @stack.last 14 | end 15 | 16 | def + 17 | @stack.push @stack.pop + @stack.pop 18 | end 19 | 20 | def / 21 | divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work 22 | @stack.push dividend / divisor 23 | end 24 | end -------------------------------------------------------------------------------- /examples/i18n/ru/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | class Calculator 4 | def initialize 5 | @stack = [] 6 | end 7 | 8 | def push(arg) 9 | @stack.push arg 10 | end 11 | 12 | def result 13 | @stack.last 14 | end 15 | 16 | def + 17 | @stack.push @stack.pop + @stack.pop 18 | end 19 | 20 | def / 21 | divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work 22 | @stack.push dividend / divisor 23 | end 24 | end -------------------------------------------------------------------------------- /examples/i18n/uk/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | class Calculator 4 | def initialize 5 | @stack = [] 6 | end 7 | 8 | def push(arg) 9 | @stack.push arg 10 | end 11 | 12 | def result 13 | @stack.last 14 | end 15 | 16 | def + 17 | @stack.push @stack.pop + @stack.pop 18 | end 19 | 20 | def / 21 | divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work 22 | @stack.push dividend / divisor 23 | end 24 | end -------------------------------------------------------------------------------- /examples/i18n/uz/lib/calculator.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | class Calculator 4 | def initialize 5 | @stack = [] 6 | end 7 | 8 | def push(arg) 9 | @stack.push arg 10 | end 11 | 12 | def result 13 | @stack.last 14 | end 15 | 16 | def + 17 | @stack.push @stack.pop + @stack.pop 18 | end 19 | 20 | def / 21 | divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work 22 | @stack.push dividend / divisor 23 | end 24 | end -------------------------------------------------------------------------------- /fixtures/tickets/features/279/py_string_indent.steps.rb: -------------------------------------------------------------------------------- 1 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 2 | 3 | require File.dirname(__FILE__) + '/../../../../features/step_definitions/cucumber_steps.rb' 4 | require File.dirname(__FILE__) + '/../../../../features/support/env.rb' 5 | 6 | Given /^multiline string$/ do |string| 7 | @string = string 8 | end 9 | 10 | Then /^string is$/ do |string| 11 | @string.should == string 12 | end 13 | -------------------------------------------------------------------------------- /fixtures/tickets/features/lib/eatting_machine.rb: -------------------------------------------------------------------------------- 1 | class EattingMachine 2 | 3 | attr_reader :fruit_total, :belly_count 4 | attr_accessor :belly_count 5 | 6 | def initialize(fruit_name, fruit_total) 7 | @fruit_name = fruit_name 8 | @fruit_total = fruit_total.to_i 9 | @belly_count = 0 10 | end 11 | 12 | def eat(count) 13 | count = count.to_i 14 | @fruit_total = @fruit_total - count 15 | @belly_count += count 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb: -------------------------------------------------------------------------------- 1 | ICANHAZ /^IN TEH BEGINNIN (\d+) CUCUMBRZ$/ do |n| 2 | @basket = Basket.new(n.to_i) 3 | end 4 | 5 | WEN /^I EAT (\d+) CUCUMBRZ$/ do |n| 6 | @belly = Belly.new 7 | @belly.eat(@basket.take(n.to_i)) 8 | end 9 | 10 | DEN /^I HAS (\d+) CUCUMBERZ IN MAH BELLY$/ do |n| 11 | @belly.cukes.should == n.to_i 12 | end 13 | 14 | DEN /^IN TEH END (\d+) CUCUMBRZ KTHXBAI$/ do |n| 15 | @basket.cukes.should == n.to_i 16 | end 17 | -------------------------------------------------------------------------------- /examples/ruby2python/features/support/env.rb: -------------------------------------------------------------------------------- 1 | require 'rubypython' 2 | 3 | ENV['PYTHONPATH'] = File.expand_path(File.dirname(__FILE__) + '/../../lib') 4 | 5 | Before do 6 | RubyPython.start 7 | @fib = RubyPython.import('fib') 8 | end 9 | 10 | After do 11 | RubyPython.stop 12 | end 13 | 14 | # RubyPython seems to expect this to exist (?) 15 | class String 16 | def end_with?(str) 17 | str = str.to_str 18 | tail = self[-str.length, str.length] 19 | tail == str 20 | end 21 | end -------------------------------------------------------------------------------- /examples/v8/features/support/env.js: -------------------------------------------------------------------------------- 1 | //The path is relative to the folder which contains the features folder 2 | World(['lib/fibonacci.js']); 3 | 4 | function assertEqual(expected, actual){ 5 | if(expected != actual){ 6 | throw 'Expected <' + expected + "> but got <" + actual + ">"; 7 | } 8 | } 9 | 10 | function assertMatches(expected, actual){ 11 | if(actual.indexOf(expected) == -1){ 12 | throw 'Expected <' + expected + "> to contain <" + actual + "> but it did not"; 13 | } 14 | } -------------------------------------------------------------------------------- /spec/cucumber/broadcaster_spec.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') 2 | 3 | module Cucumber 4 | describe Broadcaster do 5 | before do 6 | @receiver = mock('receiver') 7 | @broadcaster = Broadcaster.new([@receiver]) 8 | end 9 | 10 | it "should broadcast methods to registered objects" do 11 | @receiver.should_receive(:konbanwa).with('good evening') 12 | @broadcaster.konbanwa('good evening') 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /fixtures/self_test/features/support/env.rb: -------------------------------------------------------------------------------- 1 | begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end 2 | $KCODE = 'u' unless Cucumber::RUBY_1_9 3 | 4 | Before('@not_used') do 5 | raise "Should never run" 6 | end 7 | 8 | After('@not_used') do 9 | raise "Should never run" 10 | end 11 | 12 | Before('@background_tagged_before_on_outline') do 13 | @cukes = '888' 14 | end 15 | 16 | After('@background_tagged_before_on_outline') do 17 | @cukes.should == '888' 18 | end 19 | -------------------------------------------------------------------------------- /examples/tcl/features/fibonnacci.feature: -------------------------------------------------------------------------------- 1 | Feature: Fibonacci 2 | In order to calculate super fast fibonacci series 3 | As a Tcl hacker 4 | I want to use Tcl for that 5 | 6 | Scenario Outline: Series 7 | When I ask Tcl to calculate fibonacci for 8 | Then it should give me 9 | Examples: 10 | | n | result | 11 | | 1 | 1 | 12 | | 2 | 1 | 13 | | 3 | 2 | 14 | | 4 | 3 | 15 | | 5 | 5 | 16 | | 6 | 8 | 17 | 18 | -------------------------------------------------------------------------------- /fixtures/tickets/features/241.feature: -------------------------------------------------------------------------------- 1 | # Users want to use cucumber, so tests are necessary to verify 2 | # it is all working as expected 3 | Feature: Using the Console Formatter 4 | In order to verify this error 5 | I want to run this feature using the progress format 6 | So that it can be fixed 7 | 8 | Scenario: A normal feature 9 | Given I have a pending step 10 | When I run this feature with the progress format 11 | Then I should get a no method error for 'backtrace_line' 12 | 13 | -------------------------------------------------------------------------------- /lib/cucumber/step_definitions.rb: -------------------------------------------------------------------------------- 1 | require 'json' 2 | module Cucumber 3 | class StepDefinitions 4 | def initialize(configuration = Configuration.default) 5 | configuration = Configuration.parse(configuration) 6 | @support_code = Runtime::SupportCode.new(nil, false) 7 | @support_code.load_files_from_paths(configuration.autoload_code_paths) 8 | end 9 | 10 | def to_json 11 | @support_code.step_definitions.map{|stepdef| stepdef.to_hash}.to_json 12 | end 13 | end 14 | end -------------------------------------------------------------------------------- /examples/rspec_doubles/features/step_definitions/calvin_steps.rb: -------------------------------------------------------------------------------- 1 | class CardboardBox 2 | def initialize(transmogrifier) 3 | @transmogrifier = transmogrifier 4 | end 5 | 6 | def poke 7 | @transmogrifier.transmogrify 8 | end 9 | end 10 | 11 | Given /^I have a cardboard box$/ do 12 | transmogrifier = double('transmogrifier') 13 | transmogrifier.should_receive(:transmogrify) 14 | @box = CardboardBox.new(transmogrifier) 15 | end 16 | 17 | When /^I poke it all is good$/ do 18 | @box.poke 19 | end 20 | -------------------------------------------------------------------------------- /features/step_definitions/cucumber_steps.rb: -------------------------------------------------------------------------------- 1 | When /^I run cucumber "(.+)"$/ do |cmd| 2 | run_simple(unescape("cucumber #{cmd}"), false) 3 | end 4 | 5 | Then /^it should (pass|fail) with JSON:$/ do |pass_fail, json| 6 | JSON.parse(all_stdout).should == JSON.parse(json) 7 | assert_exiting_with(pass_fail == 'pass') 8 | end 9 | 10 | Given /^a directory without standard Cucumber project directory structure$/ do 11 | in_current_dir do 12 | FileUtils.rm_rf 'features' if File.directory?('features') 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /examples/i18n/he/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: he 2 | תכונה: חיבור 3 | כדי למנוע טעויות טפשיות 4 | בתור בור מתמטי 5 | אני רוצה שיגידו לי את הסכום של שני מספרים 6 | 7 | תבנית תרחיש: חבר שני מספרים 8 | בהינתן שהזנתי <קלט_1> למחשבון 9 | וגם שהזנתי <קלט_2> למחשבון 10 | כאשר אני לוחץ על <כפתור> 11 | אז התוצאה על המסך צריכה להיות <פלט> 12 | 13 | דוגמאות: 14 | | קלט_1 | קלט_2 | כפתור | פלט | 15 | | 20 | 30 | חבר | 50 | 16 | | 2 | 5 | חבר | 7 | 17 | | 0 | 40 | חבר | 40 | 18 | -------------------------------------------------------------------------------- /examples/i18n/sv/features/summering.feature: -------------------------------------------------------------------------------- 1 | # language: sv 2 | Egenskap: Summering 3 | För att slippa att göra dumma fel 4 | Som räknare 5 | Vill jag kunna lägga samman 6 | 7 | Scenario: två tal 8 | Givet att jag har knappat in 5 9 | Och att jag har knappat in 7 10 | När jag summerar 11 | Så ska resultatet vara 12 12 | 13 | Scenario: tre tal 14 | Givet att jag har knappat in 5 15 | Och att jag har knappat in 4 16 | Och att jag har knappat in 3 17 | När jag summerar 18 | Så ska resultatet vara 12 19 | -------------------------------------------------------------------------------- /examples/i18n/bg/features/step_definitons/calculator_steps.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | Дадено /въвел (\d+)/ do |x| 4 | calc.push x.to_i 5 | end 6 | 7 | Когато /^въведа (\d+)/ do |x| 8 | calc.push x.to_i 9 | end 10 | 11 | Когато /натисна "(.*)"/ do |op| 12 | calc.send op 13 | end 14 | 15 | То /резултата трябва да е равен на (\d+)/ do |result| 16 | calc.result.should == result.to_f 17 | end 18 | 19 | Дадено /събрал (\d+) и (\d+)/ do |x, y| 20 | Дадено %{въвел #{x}} 21 | Дадено %{въвел #{y}} 22 | Дадено %{натисна "+"} 23 | end 24 | 25 | -------------------------------------------------------------------------------- /examples/i18n/da/features/sammenlaegning.feature: -------------------------------------------------------------------------------- 1 | # language: da 2 | Egenskab: Sammenlægning 3 | For at slippe for at lave dumme fejl 4 | Som bogholder 5 | Vil jeg kunne lægge sammen 6 | 7 | Scenarie: to tal 8 | Givet at jeg har indtastet 5 9 | Og at jeg har indtastet 7 10 | Når jeg lægger sammen 11 | Så skal resultatet være 12 12 | 13 | Scenarie: tre tal 14 | Givet at jeg har indtastet 5 15 | Og at jeg har indtastet 7 16 | Og at jeg har indtastet 1 17 | Når jeg lægger sammen 18 | Så skal resultatet være 13 19 | -------------------------------------------------------------------------------- /examples/i18n/fr/features/addition2.feature: -------------------------------------------------------------------------------- 1 | # language: fr 2 | Fonctionnalité: Addition 3 | Afin de financer mon bonus avec l'argent des pigeons 4 | En tant que trader 5 | Je souhaite pouvoir additionner 2 chiffres 6 | 7 | Plan du Scénario: Addition de produits dérivés 8 | Soit une calculatrice 9 | Etant donné qu'on tape 10 | Et qu'on tape 11 | Lorsqu'on tape additionner 12 | Alors le résultat doit être 13 | 14 | Exemples: 15 | | a | b | somme | 16 | | 2 | 2 | 4 | 17 | | 2 | 3 | 5 | 18 | -------------------------------------------------------------------------------- /examples/i18n/uz/features/step_definitons/calculator_steps.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | Агар /(\d+) сонини киритсам/ do |сон| 4 | calc.push сон.to_i 5 | end 6 | 7 | Агар /"(.*)"(.*) боссам/ do |операция, _| 8 | calc.send операция 9 | end 10 | 11 | Унда /жавоб (\d+) сони булиши керак/ do |жавоб| 12 | calc.result.should == жавоб.to_f 13 | end 14 | 15 | Агар /(\d+) ва (\d+) сонини кушсам/ do |кушилувчи1, кушилувчи2| 16 | Агар %{#{кушилувчи1} сонини киритсам} 17 | Агар %{ундан сунг #{кушилувчи2} сонини киритсам} 18 | Агар %{"+"ни боссам} 19 | end 20 | -------------------------------------------------------------------------------- /gem_tasks/sdoc.rake: -------------------------------------------------------------------------------- 1 | begin 2 | require 'rake/rdoctask' 3 | require 'sdoc' # and use your RDoc task the same way you used it before 4 | 5 | Rake::RDocTask.new(:sdoc) do |rdoc| 6 | rdoc.rdoc_dir = 'doc/sdoc' 7 | rdoc.title = "Cucumber" 8 | rdoc.options += %w{--fmt shtml -N --webcvs=http://github.com/aslakhellesoy/cucumber/blob/v0.3.96/%s --title "Cucumber API" --threads 4 --main README --exclude cucumber/parser lib} 9 | rdoc.template = 'direct' # lighter template used on railsapi.com 10 | end 11 | rescue LoadError => ignore 12 | end 13 | -------------------------------------------------------------------------------- /examples/i18n/no/features/summering.feature: -------------------------------------------------------------------------------- 1 | # language: no 2 | Egenskap: Summering 3 | For å slippe å gjøre dumme feil 4 | Som en regnskapsfører 5 | Vil jeg kunne legge sammen 6 | 7 | Scenario: to tall 8 | Gitt at jeg har tastet inn 5 9 | Og at jeg har tastet inn 7 10 | Når jeg summerer 11 | Så skal resultatet være 12 12 | 13 | @iterasjon3 14 | Scenario: tre tall 15 | Gitt at jeg har tastet inn 5 16 | Og at jeg har tastet inn 7 17 | Og at jeg har tastet inn 1 18 | Når jeg summerer 19 | Så skal resultatet være 13 20 | -------------------------------------------------------------------------------- /examples/i18n/ru/features/step_definitons/calculator_steps.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | Допустим /ввожу число (\d+)/ do |число| 4 | calc.push число.to_i 5 | end 6 | 7 | Если /нажимаю "(.*)"/ do |операция| 8 | calc.send операция 9 | end 10 | 11 | То /результатом должно быть число (\d+)/ do |результат| 12 | calc.result.should == результат.to_f 13 | end 14 | 15 | Допустим /я сложил (\d+) и (\d+)/ do |слагаемое1, слагаемое2| 16 | Допустим %{я ввожу число #{слагаемое1}} 17 | Допустим %{затем ввожу число #{слагаемое2}} 18 | Допустим %{я нажимаю "+"} 19 | end -------------------------------------------------------------------------------- /examples/i18n/uz/features/consecutive_calculations.feature: -------------------------------------------------------------------------------- 1 | # language: uz 2 | Функционал: Кетма кет хисобот 3 | Мураккаб амалларни хисоблаш учун 4 | Ишлатувчилар олдинги жавоблар устидан амаллар бажармокчилардыдущей операций 5 | 6 | Тарих: 7 | Агар 3 ва 5 сонини кушсам 8 | 9 | Сценарий: охирги жавоб билан кушиш амали 10 | Агар 4 сонини киритсам 11 | Ва "+"ни боссам 12 | Унда жавоб 12 сони булиши керак 13 | 14 | Сценарий: охирги жавобни булиш 15 | Агар 2 сонини киритсам 16 | Ва "/"ни боссам 17 | Унда жавоб 4 сони булиши керак 18 | -------------------------------------------------------------------------------- /examples/i18n/ar/features/addition.feature: -------------------------------------------------------------------------------- 1 | # language: ar 2 | خاصية: الجمع 3 | من اجل تجنب الأخطاء السخيفة 4 | كشخص غبي في الرياضيات 5 | اريد معرفة ناتج جمع عددين 6 | 7 | سيناريو مخطط: جمع عددين 8 | بفرض كتابة في الآلة الحاسبة 9 | و كتابة في الآلة الحاسبة 10 | متى يتم الضغط على