├── lib ├── cucumber │ ├── parser │ │ ├── basic.rb │ │ ├── i18n.tt │ │ ├── table.tt │ │ └── treetop_ext.rb │ ├── formatters │ │ └── unicode.rb │ ├── formatter.rb │ ├── rails │ │ ├── rspec.rb │ │ └── world.rb │ ├── version.rb │ ├── broadcaster.rb │ ├── ast │ │ ├── features.rb │ │ ├── comment.rb │ │ ├── tags.rb │ │ ├── examples.rb │ │ ├── feature_element.rb │ │ ├── background.rb │ │ ├── step_collection.rb │ │ ├── py_string.rb │ │ ├── feature.rb │ │ ├── scenario.rb │ │ └── outline_table.rb │ ├── formatter │ │ ├── color_io.rb │ │ ├── cucumber.css │ │ ├── unicode.rb │ │ ├── cucumber.sass │ │ ├── rerun.rb │ │ └── progress.rb │ ├── platform.rb │ ├── core_ext │ │ ├── proc.rb │ │ ├── string.rb │ │ ├── exception.rb │ │ └── instance_exec.rb │ ├── ast.rb │ ├── parser.rb │ ├── step_match.rb │ ├── cli │ │ └── language_help_formatter.rb │ └── world.rb ├── autotest │ ├── cucumber.rb │ ├── cucumber_rails.rb │ ├── cucumber_rspec.rb │ ├── cucumber_rails_rspec.rb │ └── discover.rb └── cucumber.rb ├── examples ├── cs │ ├── .gitignore │ ├── compile.bat │ ├── README.textile │ ├── Rakefile │ ├── src │ │ └── demo │ │ │ └── Calculator.cs │ └── features │ │ ├── step_definitons │ │ └── calculator_steps.rb │ │ └── addition.feature ├── 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 │ ├── fi │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── laskin.rb │ │ └── features │ │ │ ├── jakolasku.feature │ │ │ ├── step_definitons │ │ │ └── laskin_steps.rb │ │ │ └── yhteenlasku.feature │ ├── id │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── step_definitons │ │ │ └── calculator_steps.rb │ │ │ └── addition.feature │ ├── ja │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── features │ │ │ ├── division.feature │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ │ └── calculator_steps.rb │ │ └── 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 │ ├── sk │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── division.feature │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── zh-TW │ │ ├── .gitignore │ │ ├── Rakefile │ │ ├── features │ │ │ ├── division.feature │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ │ └── calculator_steps.rb │ │ └── 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 │ ├── ar │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── da │ │ ├── Rakefile │ │ ├── lib │ │ │ └── kalkulator.rb │ │ └── features │ │ │ ├── summering.feature │ │ │ └── step_definitons │ │ │ └── kalkulator_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 │ │ │ ├── addition.feature │ │ │ └── step_definitions │ │ │ └── calculatrice_steps.rb │ ├── it │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calcolatrice.rb │ │ └── features │ │ │ ├── somma.feature │ │ │ └── step_definitons │ │ │ └── calcolatrice_steps.rb │ ├── no │ │ ├── Rakefile │ │ ├── lib │ │ │ └── kalkulator.rb │ │ └── features │ │ │ ├── support │ │ │ └── env.rb │ │ │ ├── step_definitons │ │ │ └── kalkulator_steps.rb │ │ │ └── summering.feature │ ├── pt │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculadora.rb │ │ └── features │ │ │ ├── adicao.feature │ │ │ └── step_definitions │ │ │ └── calculadora_steps.rb │ ├── se │ │ ├── Rakefile │ │ ├── lib │ │ │ └── kalkulator.rb │ │ └── features │ │ │ ├── summering.feature │ │ │ └── step_definitons │ │ │ └── kalkulator_steps.rb │ ├── en-lol │ │ ├── Rakefile │ │ ├── lib │ │ │ ├── belly.rb │ │ │ └── basket.rb │ │ └── features │ │ │ ├── stuffing.feature │ │ │ ├── support │ │ │ └── env.rb │ │ │ └── step_definitions │ │ │ └── cucumbrz_steps.rb │ ├── ro │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── suma.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── zh-CN │ │ ├── Rakefile │ │ ├── lib │ │ │ └── calculator.rb │ │ └── features │ │ │ ├── addition.feature │ │ │ └── step_definitons │ │ │ └── calculator_steps.rb │ ├── README.textile │ └── Rakefile ├── java │ ├── src │ │ ├── .gitignore │ │ └── cucumber │ │ │ └── demo │ │ │ ├── .gitignore │ │ │ └── Hello.java │ ├── features │ │ ├── tree.feature │ │ ├── step_definitons │ │ │ ├── tree_steps.rb │ │ │ └── hello_steps.rb │ │ └── hello.feature │ ├── Rakefile │ └── README.textile ├── self_test │ ├── features │ │ ├── support │ │ │ ├── env.rb │ │ │ └── tag_count_formatter.rb │ │ ├── failing_expectation.feature │ │ ├── background │ │ │ ├── background_with_name.feature │ │ │ ├── pending_background.feature │ │ │ ├── passing_background.feature │ │ │ ├── failing_background.feature │ │ │ ├── failing_background_after_success.feature │ │ │ ├── scenario_outline_passing_background.feature │ │ │ ├── scenario_outline_failing_background.feature │ │ │ └── multiline_args_background.feature │ │ ├── lots_of_undefined.feature │ │ ├── undefined_multiline_args.feature │ │ ├── call_undefined_step_from_step_def.feature │ │ ├── sample.feature │ │ ├── outline_sample.feature │ │ ├── tons_of_cukes.feature │ │ └── step_definitions │ │ │ └── sample_steps.rb │ ├── Rakefile │ └── README.textile ├── tickets │ ├── cucumber.yml │ ├── features │ │ ├── 177 │ │ │ ├── 3.feature │ │ │ ├── 1.feature │ │ │ └── 2.feature │ │ ├── step_definitons │ │ │ ├── 246_steps.rb │ │ │ ├── 248_steps.rb │ │ │ ├── scenario_outline_steps.rb │ │ │ └── tickets_steps.rb │ │ ├── 180.feature │ │ ├── 246.feature │ │ ├── 248.feature │ │ ├── lib │ │ │ ├── pantry.rb │ │ │ └── eatting_machine.rb │ │ ├── 241.feature │ │ ├── 236.feature │ │ ├── tickets.feature │ │ └── 172.feature │ └── Rakefile ├── sinatra │ ├── views │ │ ├── layout.erb │ │ └── add.erb │ ├── Rakefile │ ├── app.rb │ └── features │ │ ├── add.feature │ │ ├── step_definitions │ │ └── add_steps.rb │ │ └── support │ │ └── env.rb ├── pure_java │ └── README.textile ├── watir │ ├── Rakefile │ ├── features │ │ ├── search.feature │ │ ├── support │ │ │ └── env.rb │ │ └── step_definitons │ │ │ └── search_steps.rb │ └── README.textile ├── selenium │ ├── Rakefile │ └── features │ │ ├── search.feature │ │ ├── support │ │ └── env.rb │ │ └── step_definitons │ │ └── search_steps.rb ├── test_unit │ ├── Rakefile │ └── features │ │ ├── test_unit.feature │ │ └── step_definitions │ │ └── test_unit_steps.rb ├── dos_line_endings │ ├── Rakefile │ └── features │ │ └── dos_line_endings.feature └── selenium_webrat │ ├── Rakefile │ └── features │ ├── search.feature │ ├── step_definitons │ └── search_steps.rb │ └── support │ └── env.rb ├── specs ├── spec.opts ├── cucumber │ ├── rails │ │ ├── stubs │ │ │ ├── test_help.rb │ │ │ └── mini_rails.rb │ │ └── world_spec.rb │ ├── treetop_parser │ │ ├── empty_feature.feature │ │ ├── empty_scenario_outline.feature │ │ ├── fit_scenario.feature │ │ ├── given_scenario.feature │ │ ├── spaces.feature │ │ ├── invalid_scenario_outlines.feature │ │ ├── with_comments.feature │ │ ├── empty_scenario.feature │ │ ├── with_tags.feature │ │ ├── multiline_steps.feature │ │ ├── scenario_outline.feature │ │ ├── test_dos.feature │ │ └── multiple_tables.feature │ ├── broadcaster_spec.rb │ ├── ast │ │ ├── tags_spec.rb │ │ ├── step_collection_spec.rb │ │ ├── background_spec.rb │ │ ├── feature_spec.rb │ │ ├── py_string_spec.rb │ │ ├── scenario_spec.rb │ │ ├── feature_factory.rb │ │ ├── scenario_outline_spec.rb │ │ └── step_spec.rb │ ├── sell_cucumbers.feature │ ├── formatter │ │ ├── html │ │ │ ├── cucumber.css │ │ │ ├── cucumber.js │ │ │ └── index.html │ │ ├── color_io_spec.rb │ │ └── ansicolor_spec.rb │ ├── world │ │ └── pending_spec.rb │ ├── parser │ │ └── table_parser_spec.rb │ └── core_ext │ │ ├── string_spec.rb │ │ └── proc_spec.rb └── spec_helper.rb ├── cucumber.yml ├── .gitattributes ├── features ├── step_definitions │ ├── extra_steps.rb │ └── cucumber_steps.rb ├── support │ └── env.rb ├── custom_formatter.feature ├── snippet.feature ├── cucumber_cli_diff_disabled.feature ├── report_called_undefined_steps.feature └── cucumber_cli_outlines.feature ├── logos ├── gideon-bullock-1.png └── gideon-bullock-2.png ├── README.txt ├── gem_tasks ├── flog.rake ├── environment.rake ├── yard.rake ├── features.rake ├── fix_cr_lf.rake ├── deployment.rake ├── gemspec.rake └── rspec.rake ├── .gitignore ├── rails_generators ├── cucumber │ ├── templates │ │ ├── cucumber │ │ ├── paths.rb │ │ ├── cucumber.rake │ │ └── env.rb │ ├── USAGE │ └── cucumber_generator.rb └── feature │ ├── USAGE │ ├── templates │ ├── steps.erb │ └── feature.erb │ └── feature_generator.rb ├── bin └── cucumber ├── Rakefile ├── config ├── requirements.rb └── hoe.rb └── License.txt /lib/cucumber/parser/basic.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/cs/.gitignore: -------------------------------------------------------------------------------- 1 | *.dll 2 | -------------------------------------------------------------------------------- /specs/spec.opts: -------------------------------------------------------------------------------- 1 | --colour 2 | --diff -------------------------------------------------------------------------------- /examples/i18n/de/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/en/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/fi/.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/sk/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/i18n/zh-TW/.gitignore: -------------------------------------------------------------------------------- 1 | features.html -------------------------------------------------------------------------------- /examples/java/src/.gitignore: -------------------------------------------------------------------------------- 1 | cucumber_demo.jar -------------------------------------------------------------------------------- /cucumber.yml: -------------------------------------------------------------------------------- 1 | default: --format progress features 2 | -------------------------------------------------------------------------------- /examples/java/src/cucumber/demo/.gitignore: -------------------------------------------------------------------------------- 1 | *.class -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | spec/cucumber/treetop_parser/test_dos.feature -crlf -------------------------------------------------------------------------------- /examples/self_test/features/support/env.rb: -------------------------------------------------------------------------------- 1 | require 'spec/expectations' -------------------------------------------------------------------------------- /features/step_definitions/extra_steps.rb: -------------------------------------------------------------------------------- 1 | Given /^missing$/ do 2 | end 3 | -------------------------------------------------------------------------------- /specs/cucumber/rails/stubs/test_help.rb: -------------------------------------------------------------------------------- 1 | # This file is loaded by rails/world.rb 2 | -------------------------------------------------------------------------------- /examples/cs/compile.bat: -------------------------------------------------------------------------------- 1 | csc /target:library /out:Calculator.dll src\demo\Calculator.cs -------------------------------------------------------------------------------- /logos/gideon-bullock-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcoury/cucumber/master/logos/gideon-bullock-1.png -------------------------------------------------------------------------------- /logos/gideon-bullock-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fcoury/cucumber/master/logos/gideon-bullock-2.png -------------------------------------------------------------------------------- /examples/cs/README.textile: -------------------------------------------------------------------------------- 1 | See "IronRuby and .NET":http://github.com/aslakhellesoy/cucumber/wikis/ironruby-and-net -------------------------------------------------------------------------------- /lib/cucumber/formatters/unicode.rb: -------------------------------------------------------------------------------- 1 | # This is for backwards compatibility 2 | require 'cucumber/formatter/unicode' -------------------------------------------------------------------------------- /lib/cucumber/formatter.rb: -------------------------------------------------------------------------------- 1 | %w{color_io pretty progress profile rerun html usage}.each{|n| require "cucumber/formatter/#{n}"} -------------------------------------------------------------------------------- /examples/tickets/cucumber.yml: -------------------------------------------------------------------------------- 1 | default: --format pretty 2 | html: --format html --out features.html 3 | progress: --format progress -i -n -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/empty_feature.feature: -------------------------------------------------------------------------------- 1 | Feature: No scenarios yet 2 | In order to ... 3 | As a ... 4 | I want to ... 5 | -------------------------------------------------------------------------------- /examples/i18n/ru/features/support/world.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | World do 4 | def calc 5 | @calc ||= Calculator.new 6 | end 7 | end -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | = Cucumber 2 | 3 | The main website is at http://cukes.info/ 4 | The documentation is at http://github.com/aslakhellesoy/cucumber/wikis/home/ 5 | -------------------------------------------------------------------------------- /examples/sinatra/views/layout.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | Addition 4 | 5 | 6 | <%= yield %> 7 | 8 | -------------------------------------------------------------------------------- /examples/self_test/features/failing_expectation.feature: -------------------------------------------------------------------------------- 1 | Feature: Failing expectation 2 | 3 | Scenario: Failing expectation 4 | Given failing expectation 5 | -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/empty_scenario_outline.feature: -------------------------------------------------------------------------------- 1 | Feature: Empty scenarios outlines should work 2 | 3 | Scenario Outline: Implement me please 4 | -------------------------------------------------------------------------------- /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/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 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | nbproject 2 | coverage 3 | pkg 4 | doc 5 | .yardoc 6 | *.log 7 | *.pid 8 | .eprj 9 | .tmtags 10 | *~ 11 | .DS_Store 12 | *.swp 13 | target 14 | *.tmproj 15 | -------------------------------------------------------------------------------- /examples/sinatra/views/add.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
-------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /gem_tasks/yard.rake: -------------------------------------------------------------------------------- 1 | begin 2 | require 'yard' 3 | 4 | YARD::Rake::YardocTask.new do |t| 5 | t.files = ['lib/**/*.rb'] 6 | end 7 | rescue LoadError => ignore 8 | end -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/fit_scenario.feature: -------------------------------------------------------------------------------- 1 | Some title 2 | 3 | Scenario: second 4 | Given 'bind me please' 5 | 6 | More Examples: 7 | |c| 8 | |I can have spaces| -------------------------------------------------------------------------------- /examples/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/pure_java/README.textile: -------------------------------------------------------------------------------- 1 | h1. Cucumber with pure Java 2 | 3 | You can use Cucumber with step definitions in pure Java. 4 | 5 | See http://github.com/aslakhellesoy/cucumber_java/tree/master -------------------------------------------------------------------------------- /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 = "--format pretty" 6 | end -------------------------------------------------------------------------------- /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 = "--format pretty" 6 | end -------------------------------------------------------------------------------- /gem_tasks/features.rake: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = "--format progress" 6 | end -------------------------------------------------------------------------------- /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 = "--language ar" 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 = "--language da" 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 = "--language de" 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 = "--language en" 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 = "--language es" 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 = "--language et" 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 = "--language fr" 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 = "--language id" 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 = "--language it" 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 = "--language ko" 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 = "--language no" 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 = "--language pt" 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 = "--language ru" 6 | end -------------------------------------------------------------------------------- /examples/i18n/se/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = "--language se" 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 = "--language sk" 6 | end -------------------------------------------------------------------------------- /examples/selenium/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = "--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 = "--format pretty" 6 | end -------------------------------------------------------------------------------- /examples/dos_line_endings/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = "--format pretty" 6 | end -------------------------------------------------------------------------------- /examples/i18n/en-lol/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = "--language en-lol" 6 | end -------------------------------------------------------------------------------- /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 = "--language fi" 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 = "--language ja" 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/ja/features/division.feature: -------------------------------------------------------------------------------- 1 | フィーチャ: 除算 2 | バカな間違いを避けるために 3 | 有理数も計算できること 4 | 5 | シナリオ: ふつうの数値 6 | 前提 3 を入力 7 | かつ 2 を入力 8 | もし divide を押した 9 | ならば 1.5 を表示 10 | -------------------------------------------------------------------------------- /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 = "--language lt" 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 = "--language ro" 6 | end 7 | -------------------------------------------------------------------------------- /examples/i18n/zh-CN/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = "--language zh-CN" 6 | end -------------------------------------------------------------------------------- /examples/i18n/zh-TW/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = "--language zh-TW" 6 | end -------------------------------------------------------------------------------- /examples/selenium_webrat/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new do |t| 5 | t.cucumber_opts = "--format pretty" 6 | end -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/given_scenario.feature: -------------------------------------------------------------------------------- 1 | Some title 2 | 3 | Scenario: first 4 | Given a 5 | Given b 6 | 7 | Scenario: second 8 | GivenScenario: first 9 | Given c -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /features/support/env.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'spec/expectations' 3 | require 'fileutils' 4 | 5 | After do 6 | FileUtils.rm_rf 'examples/self_test/tmp' 7 | FileUtils.mkdir 'examples/self_test/tmp' 8 | end -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/spaces.feature: -------------------------------------------------------------------------------- 1 | 2 | 3 | Feature: Some title 4 | 5 | Scenario: first 6 | 7 | Given a 8 | 9 | Scenario: second 10 | 11 | Given b 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/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 -------------------------------------------------------------------------------- /examples/i18n/zh-TW/features/division.feature: -------------------------------------------------------------------------------- 1 | 功能: 除法 2 | 為了避免愚蠢的錯誤 3 | 收銀機必須要能夠計算除法 4 | 而且必需能顯示非整數的結果 5 | 6 | 場景: 將兩個數相除 7 | 假設我已經在計算機上輸入 3 8 | 而且我已經在計算機上輸入 2 9 | 當我按下 divide 10 | 那麼螢幕上應該顯示 1.5 11 | -------------------------------------------------------------------------------- /examples/i18n/da/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/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/se/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/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/self_test/features/background/background_with_name.feature: -------------------------------------------------------------------------------- 1 | Feature: background with name 2 | 3 | Background: I'm a background and I'm ok 4 | Given '10' cukes 5 | 6 | Scenario: example 7 | Then I should have '10' cukes -------------------------------------------------------------------------------- /lib/cucumber/rails/rspec.rb: -------------------------------------------------------------------------------- 1 | require 'cucumber/rails/world' 2 | require 'spec/expectations' 3 | require 'spec/rails/matchers' 4 | 5 | Cucumber::Rails::World.class_eval do 6 | include Spec::Matchers 7 | include Spec::Rails::Matchers 8 | end 9 | -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/invalid_scenario_outlines.feature: -------------------------------------------------------------------------------- 1 | Feature: Invalid Scenario Outlines 2 | 3 | Scenario Outline: I must have steps if I have a examples table 4 | Examples: 5 | | Name | 6 | | Izanaki | 7 | | Izanami | 8 | -------------------------------------------------------------------------------- /examples/i18n/ru/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | require 'spec/expectations' 3 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 4 | require 'cucumber/formatter/unicode' 5 | require 'calculator' 6 | $KCODE='u' unless Cucumber::RUBY_1_9 -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/with_comments.feature: -------------------------------------------------------------------------------- 1 | # Header title 2 | # Two lines 3 | Feature: Some header 4 | 5 | # Scenario header 6 | # on two lines 7 | Scenario: Some scenario 8 | Given one 9 | # When two 10 | Then three -------------------------------------------------------------------------------- /examples/i18n/ko/features/division.feature: -------------------------------------------------------------------------------- 1 | 기능: 나눗셈 2 | 예기치못한 실수을 방지하기 위해 3 | 분수를 계산 능력 요구한다 4 | 5 | 시나리오: 보통 숫자 6 | 조건 계산기에 3을 입력했음 7 | 그리고 계산기에 2을 입력했음 8 | 만일 내가 divide를 누르면 9 | 그러면 화면에 출력된 결과는 1.5이다 10 | 11 | -------------------------------------------------------------------------------- /examples/i18n/en-lol/features/stuffing.feature: -------------------------------------------------------------------------------- 1 | # stuffing.feature 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/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/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-lol/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | $KCODE='u' unless Cucumber::RUBY_1_9 3 | require 'cucumber/formatter/unicode' 4 | require 'spec/expectations' 5 | 6 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 7 | require 'basket' 8 | require 'belly' 9 | -------------------------------------------------------------------------------- /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/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/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/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. -------------------------------------------------------------------------------- /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/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 -------------------------------------------------------------------------------- /lib/cucumber/version.rb: -------------------------------------------------------------------------------- 1 | module Cucumber #:nodoc: 2 | class VERSION #:nodoc: 3 | MAJOR = 0 4 | MINOR = 2 5 | TINY = 3 6 | PATCH = 1 # Set to nil for official release 7 | 8 | STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.') 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /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/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 -------------------------------------------------------------------------------- /examples/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| -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /examples/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 | -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/empty_scenario.feature: -------------------------------------------------------------------------------- 1 | Feature: Empty scenarios should work 2 | 3 | Scenario: Complete scenario 4 | Given a valid API key 5 | 6 | Scenario: Will write at somepoint 7 | 8 | Scenario: Another Complete scenario 9 | Given an invalid API key 10 | -------------------------------------------------------------------------------- /examples/i18n/no/features/support/env.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | $KCODE='u' unless Cucumber::RUBY_1_9 3 | require 'spec/expectations' 4 | $:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project 5 | require 'cucumber/formatter/unicode' 6 | require 'kalkulator' 7 | -------------------------------------------------------------------------------- /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/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" -------------------------------------------------------------------------------- /rails_generators/cucumber/templates/cucumber: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/cucumber/bin/cucumber") 4 | rescue LoadError => e 5 | raise unless e.to_s =~ /cucumber/ 6 | require "rubygems" 7 | load File.join(Gem.bindir, "cucumber") 8 | end -------------------------------------------------------------------------------- /examples/self_test/features/background/pending_background.feature: -------------------------------------------------------------------------------- 1 | Feature: Pending background sample 2 | 3 | Background: 4 | Given pending 5 | 6 | Scenario: pending background 7 | Then I should have '10' cukes 8 | 9 | Scenario: another pending background 10 | Then I should have '10' cukes -------------------------------------------------------------------------------- /examples/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/self_test/features/background/passing_background.feature: -------------------------------------------------------------------------------- 1 | Feature: Passing background sample 2 | 3 | Background: 4 | Given '10' cukes 5 | 6 | Scenario: passing background 7 | Then I should have '10' cukes 8 | 9 | Scenario: another passing background 10 | Then I should have '10' cukes -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /features/custom_formatter.feature: -------------------------------------------------------------------------------- 1 | Feature: Custom Formatter 2 | 3 | Scenario: count tags 4 | When I run cucumber --format Tag::Count features 5 | Then it should fail with 6 | """ 7 | | four | lots | one | three | two | 8 | | 1 | 1 | 1 | 2 | 1 | 9 | 10 | """ 11 | -------------------------------------------------------------------------------- /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/ro/features/suma.feature: -------------------------------------------------------------------------------- 1 | Functionalitate: suma 2 | Pentru a nu face erori stupide 3 | Ca utilizator 4 | Vreau sa stiu suma a doua numere 5 | 6 | Scenariu: suma a doua numere 7 | Daca introduc 5 8 | Si apoi introduc 7 9 | Cand apas suma 10 | Atunci rezultatul trebuie sa fie 12 11 | -------------------------------------------------------------------------------- /examples/java/features/tree.feature: -------------------------------------------------------------------------------- 1 | Feature: Tree 2 | In order to have more robust Java software 3 | I want to use Cucumber against Java classes 4 | 5 | Scenario: Use java.util.TreeSet 6 | Given I have an empty set 7 | When I add hello 8 | And I add world 9 | Then the contents should be hello world 10 | -------------------------------------------------------------------------------- /specs/cucumber/rails/world_spec.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../../spec_helper' 2 | $:.unshift(File.dirname(__FILE__) + '/stubs') 3 | 4 | describe "Rails world" do 5 | 6 | it "should run without Test::Unit.run defined" do 7 | require "mini_rails" 8 | require "cucumber/rails/world" 9 | end 10 | 11 | end -------------------------------------------------------------------------------- /specs/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gem 'rspec' 3 | require 'spec' 4 | require 'spec/autorun' 5 | 6 | ENV['CUCUMBER_COLORS']=nil 7 | $:.unshift(File.dirname(__FILE__) + '/../lib') 8 | require 'cucumber' 9 | Cucumber.load_language('en') 10 | $:.unshift(File.dirname(__FILE__)) 11 | 12 | ::Term::ANSIColor.coloring = true 13 | -------------------------------------------------------------------------------- /examples/i18n/it/features/somma.feature: -------------------------------------------------------------------------------- 1 | Funzionalità: somma 2 | Per evitare di fare errori stupidi 3 | Come utente 4 | Voglio sapere la somma di due numeri 5 | 6 | Scenario: la somma di due numeri 7 | Dato che ho inserito 5 8 | E che ho inserito 7 9 | Quando premo somma 10 | Allora il risultato deve essere 12 11 | -------------------------------------------------------------------------------- /examples/i18n/sk/features/division.feature: -------------------------------------------------------------------------------- 1 | Požiadavka: Delenie 2 | Aby som sa vyhol hlúpym chybám 3 | Pokladníci musia vedieť vypočítať podiel 4 | 5 | Scenár: Prirodzené čísla 6 | Pokiaľ Zadám číslo 3 do kalkulačky 7 | A Zadám číslo 2 do kalkulačky 8 | Keď Stlačím tlačidlo divide 9 | Tak Výsledok by mal byť 1.5 10 | -------------------------------------------------------------------------------- /examples/selenium/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 "rspec" 9 | Then I should see a link to http://rspec.info/ 10 | -------------------------------------------------------------------------------- /examples/cs/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new(:features) do |t| 5 | t.cucumber_opts = "--format pretty" 6 | end 7 | 8 | task :features => :compile 9 | 10 | task :compile do 11 | sh "csc /target:library /out:Demo.dll src\\demo\\Calculator.cs" 12 | end -------------------------------------------------------------------------------- /examples/i18n/lt/features/division.feature: -------------------------------------------------------------------------------- 1 | Feature: Dalyba 2 | Norint išvengti klaidų 3 | Kasininkai privalo mokėti skaičiuoti trupmenas 4 | 5 | Scenarijus: Realieji skaičiai 6 | Duota aš įvedžiau 3 į skaičiuotuvą 7 | Ir aš įvedžiau 2 į skaičiuotuvą 8 | Kai aš paspaudžiu "divide" 9 | Tada rezultatas ekrane turi būti 1.5 10 | -------------------------------------------------------------------------------- /examples/selenium_webrat/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 "rspec" 9 | Then I should see a link to http://rspec.info/ 10 | -------------------------------------------------------------------------------- /lib/cucumber/broadcaster.rb: -------------------------------------------------------------------------------- 1 | module Cucumber 2 | class Broadcaster 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/id/features/division.feature: -------------------------------------------------------------------------------- 1 | Fitur: Division 2 | Untuk hindari kesalahan konyol 3 | Kasir harus dapat menghitung pembagian 4 | 5 | Skenario: bilangan biasa 6 | Dengan aku sudah masukkan 3 ke kalkulator 7 | Dan aku sudah masukkan 2 ke kalkulator 8 | Ketika aku tekan divide 9 | Maka hasilnya harus 1.5 di layar 10 | -------------------------------------------------------------------------------- /examples/i18n/zh-CN/features/addition.feature: -------------------------------------------------------------------------------- 1 | 功能:加法 2 | 为了避免一些愚蠢的错误 3 | 作为一个数学白痴 4 | 我希望有人告诉我数字相加的结果 5 | 6 | 场景: 两个数相加 7 | 假如我已经在计算器里输入6 8 | 而且我已经在计算器里输入7 9 | 当我按相加按钮 10 | 那么我应该在屏幕上看到的结果是13 11 | 12 | 场景: 三个数相加 13 | 假如我已经在计算器里输入6 14 | 而且我已经在计算器里输入7 15 | 而且我已经在计算器里输入1 16 | 当我按相加按钮 17 | 那么我应该在屏幕上看到的结果是14 18 | -------------------------------------------------------------------------------- /examples/self_test/features/background/failing_background.feature: -------------------------------------------------------------------------------- 1 | Feature: Failing background sample 2 | 3 | Background: 4 | Given failing without a table 5 | And '10' cukes 6 | 7 | Scenario: failing background 8 | Then I should have '10' cukes 9 | 10 | Scenario: another failing background 11 | Then I should have '10' cukes -------------------------------------------------------------------------------- /examples/self_test/features/sample.feature: -------------------------------------------------------------------------------- 1 | @one 2 | Feature: Sample 3 | 4 | @two @three 5 | Scenario: Missing 6 | Given missing 7 | 8 | @three 9 | Scenario: Passing 10 | Given passing 11 | |a|b| 12 | |c|d| 13 | 14 | @four 15 | Scenario: Failing 16 | Given failing 17 | """ 18 | hello 19 | """ 20 | -------------------------------------------------------------------------------- /specs/cucumber/rails/stubs/mini_rails.rb: -------------------------------------------------------------------------------- 1 | # Define some stubs to fake Rails... 2 | module ActiveRecord 3 | class Base 4 | end 5 | end 6 | 7 | module ActionController 8 | class Dispatcher 9 | end 10 | 11 | class Base 12 | end 13 | 14 | class IntegrationTest 15 | def self.use_transactional_fixtures=(x) 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /examples/i18n/ru/features/addition.feature: -------------------------------------------------------------------------------- 1 | Функционал: Сложение чисел 2 | Чтобы не складывать в уме 3 | Все, у кого с этим туго 4 | Хотят автоматическое сложение целых чисел 5 | 6 | Сценарий: Сложение двух целых чисел 7 | Допустим я ввожу число 50 8 | И затем ввожу число 70 9 | Если я нажимаю "+" 10 | То результатом должно быть число 120 -------------------------------------------------------------------------------- /examples/java/features/step_definitons/tree_steps.rb: -------------------------------------------------------------------------------- 1 | require 'spec/expectations' 2 | include_class 'java.util.TreeSet' 3 | 4 | Given /I have an empty set/ do 5 | @set = TreeSet.new 6 | end 7 | 8 | When /I add (\w+)/ do |s| 9 | @set.add(s) 10 | end 11 | 12 | Then /the contents should be (.*)/ do |s| 13 | @set.to_a.join(" ").should == s 14 | end 15 | -------------------------------------------------------------------------------- /examples/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 | -------------------------------------------------------------------------------- /bin/cucumber: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Add '.rb' to work around a bug in IronRuby's File#dirname 3 | $:.unshift(File.dirname(__FILE__ + '.rb') + '/../lib') unless $:.include?(File.dirname(__FILE__ + '.rb') + '/../lib') 4 | 5 | require 'cucumber/cli/main' 6 | Cucumber::Cli::Main.execute(ARGV.dup) # The dup is to keep ARGV intact, so that tools like ruby-debug can respawn. 7 | -------------------------------------------------------------------------------- /examples/java/features/hello.feature: -------------------------------------------------------------------------------- 1 | Feature: Hello 2 | In order to have more friends 3 | I want to say hello 4 | 5 | Scenario: Personal greeting 6 | Given my name is Aslak 7 | When I greet David 8 | Then he should hear Hi, David. I'm Aslak. 9 | And I should remember David as a friend 10 | And I should get David's phone number 11 | 12 | -------------------------------------------------------------------------------- /examples/dos_line_endings/features/dos_line_endings.feature: -------------------------------------------------------------------------------- 1 | Feature: DOS line endings 2 | In order to have less bug reports 3 | As a windows developer 4 | I want to write features with DOS line endigs 5 | 6 | Scenario: Just lots of DOS 7 | Given I am on DOS 8 | And Any version of Windows is really just DOS 9 | Then Windows still sucks 10 | -------------------------------------------------------------------------------- /examples/i18n/en/features/division.feature: -------------------------------------------------------------------------------- 1 | Feature: Division 2 | In order to avoid silly mistakes 3 | Cashiers must be able to calculate a fraction 4 | 5 | Scenario: Regular numbers 6 | Given I have entered 3 into the calculator 7 | And I have entered 2 into the calculator 8 | When I press divide 9 | Then the result should be 1.5 on the screen 10 | -------------------------------------------------------------------------------- /examples/i18n/et/features/jagamine.feature: -------------------------------------------------------------------------------- 1 | Omadus: Jagamine 2 | Rumalate vigade vältimiseks 3 | Peavad kassapidajad saama arvutada murdudes 4 | 5 | Stsenaarium: Tavalised numrbid 6 | Eeldades et olen sisestanud kalkulaatorisse numbri 3 7 | Ja olen sisestanud kalkulaatorisse numbri 2 8 | Kui ma vajutan jaga 9 | Siis vastuseks peab ekraanil kuvatama 1.5 10 | -------------------------------------------------------------------------------- /examples/i18n/fi/features/jakolasku.feature: -------------------------------------------------------------------------------- 1 | Ominaisuus: Jakolasku 2 | Välttyäkseen hölmöiltä virheiltä 3 | Kassanhoitajan on voitava laskea osamäärä 4 | 5 | Tapaus: Kokonaislukujen jakolasku 6 | Oletetaan että olen syöttänyt laskimeen luvun 3 7 | Ja että olen syöttänyt laskimeen luvun 2 8 | Kun painan "jaa" 9 | Niin laskimen ruudulla pitäisi näkyä tulos 1.5 10 | -------------------------------------------------------------------------------- /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 | Gitt /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/pt/features/adicao.feature: -------------------------------------------------------------------------------- 1 | Funcionalidade: Adição 2 | Para evitar erros bobos 3 | Como um péssimo matemático 4 | Eu quero saber como somar dois números 5 | 6 | Cenário: Adicionar dois números 7 | Dado que eu digitei 50 na calculadora 8 | E que eu digitei 70 na calculadora 9 | Quando eu aperto o botão de soma 10 | Então o resultado na calculadora deve ser 120 -------------------------------------------------------------------------------- /examples/java/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new(:features) do |t| 5 | t.cucumber_opts = "--format pretty" 6 | end 7 | 8 | task :features => :compile 9 | 10 | task :compile do 11 | sh "javac src/cucumber/demo/Hello.java && jar cf src/cucumber_demo.jar -C src cucumber/demo/Hello.class" 12 | end -------------------------------------------------------------------------------- /examples/i18n/ja/features/addition.feature: -------------------------------------------------------------------------------- 1 | フィーチャ: 加算 2 | バカな間違いを避けるために 3 | 数学オンチとして 4 | 2つの数の合計を知りたい 5 | 6 | シナリオテンプレート: 2つの数の加算について 7 | 前提 <値1> を入力 8 | かつ <値2> を入力 9 | もし <ボタン> を押した 10 | ならば <結果> を表示 11 | 12 | 例: 13 | | 値1 | 値2 | ボタン | 結果 | 14 | | 20 | 30 | add | 50 | 15 | | 2 | 5 | add | 7 | 16 | | 0 | 40 | add | 40 | 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | ENV['NODOT'] = 'true' # We don't want class diagrams in RDoc 2 | require 'config/requirements' 3 | require 'config/hoe' # setup Hoe + all gem configuration 4 | 5 | Dir['gem_tasks/**/*.rake'].each { |rake| load rake } 6 | 7 | # Hoe gives us :default => :test, but we don't have Test::Unit tests. 8 | Rake::Task[:default].clear_prerequisites rescue nil # For some super weird reason this fails for some... -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/with_tags.feature: -------------------------------------------------------------------------------- 1 | # Uhm hai 2 | # nai 3 | @nice @hallo 4 | Feature: With tags 5 | 6 | @one @two 7 | Scenario: Complete scenario 8 | Given a valid API key 9 | 10 | @three 11 | Scenario: Will write at somepoint 12 | 13 | @four @$$ 14 | Scenario: Another Complete scenario 15 | Given an invalid API key 16 | 17 | @six 18 | Scenario Outline: Jalla 19 | -------------------------------------------------------------------------------- /config/requirements.rb: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | include FileUtils 3 | 4 | require 'rubygems' 5 | %w[rake hoe].each do |req_gem| 6 | begin 7 | require req_gem 8 | rescue LoadError 9 | puts "This Rakefile requires the '#{req_gem}' RubyGem." 10 | puts "Installation: gem install #{req_gem} -y" 11 | exit 12 | end 13 | end 14 | 15 | $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib])) 16 | -------------------------------------------------------------------------------- /examples/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/ko/features/addition.feature: -------------------------------------------------------------------------------- 1 | 기능: 덧셈 2 | 예기치못한 실수을 방지하기 위해 3 | 수학을 잘 못하는 사람으로써 4 | 두숫자의 합을 알고 싶다 5 | 6 | 시나리오: 두 숫자를 더하기 7 | 조건 계산기에 50을 입력했음 8 | 그리고 계산기에 70을 입력했음 9 | 만일 내가 add를 누르면 10 | 그러면 화면에 출력된 결과는 120이다 11 | 12 | 예: 13 | | 입력1 | 입력2 | 버튼 | 결과 | 14 | | 20 | 30 | add | 50 | 15 | | 2 | 5 | add | 7 | 16 | | 0 | 40 | add | 40 | 17 | -------------------------------------------------------------------------------- /examples/i18n/zh-TW/features/addition.feature: -------------------------------------------------------------------------------- 1 | 功能: 加法 2 | 為了避免愚蠢的錯誤 3 | 作為一個數學白痴 4 | 我希望有人能告訴我兩個數相加的結果 5 | 6 | 場景大綱: 將兩個數相加 7 | 假設我已經在計算機上輸入 <數值_1> 8 | 而且我已經在計算機上輸入 <數值_2> 9 | 當我按下 <按鈕> 10 | 那麼螢幕上應該顯示 <結果> 11 | 12 | 例子: 13 | | 數值_1 | 數值_2 | 按鈕 | 結果 | 14 | | 20 | 30 | add | 50 | 15 | | 2 | 5 | add | 7 | 16 | | 0 | 40 | add | 40 | 17 | -------------------------------------------------------------------------------- /examples/selenium_webrat/features/step_definitons/search_steps.rb: -------------------------------------------------------------------------------- 1 | Given 'I am on the Google search page' do 2 | visit('http://www.google.com/') 3 | end 4 | 5 | When /I search for "(.*)"/ do |query| 6 | fill_in('q', :with => query) 7 | click_button('btnG') 8 | selenium.wait_for_page_to_load 9 | end 10 | 11 | Then /I should see a link to (.*)/ do |expected_url| 12 | click_link(expected_url) 13 | end 14 | -------------------------------------------------------------------------------- /examples/self_test/features/background/failing_background_after_success.feature: -------------------------------------------------------------------------------- 1 | Feature: Failing background after previously successful background sample 2 | 3 | Background: 4 | Given passing without a table 5 | And '10' global cukes 6 | 7 | Scenario: passing background 8 | Then I should have '10' global cukes 9 | 10 | Scenario: failing background 11 | Then I should have '10' global cukes -------------------------------------------------------------------------------- /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 | response.should contain(/#{text}/m) 15 | end 16 | -------------------------------------------------------------------------------- /examples/selenium/features/support/env.rb: -------------------------------------------------------------------------------- 1 | require 'spec/expectations' 2 | require 'selenium' 3 | 4 | # "before all" 5 | browser = Selenium::SeleniumDriver.new("localhost", 4444, "*chrome", "http://localhost", 15000) 6 | 7 | Before do 8 | @browser = browser 9 | @browser.start 10 | end 11 | 12 | After do 13 | @browser.stop 14 | end 15 | 16 | # "after all" 17 | at_exit do 18 | browser.close rescue nil 19 | end -------------------------------------------------------------------------------- /examples/i18n/de/features/division.feature: -------------------------------------------------------------------------------- 1 | Funktionalität: Division 2 | Um dumme Fehler zu vermeiden 3 | müssen Kassierer in der Lage sein einen Bruchteil zu berechnen 4 | 5 | Szenario: Normale Zahlen 6 | Gegeben sei ich habe 3 in den Taschenrechner eingegeben 7 | Und ich habe 2 in den Taschenrechner eingegeben 8 | Wenn ich divide drücke 9 | Dann sollte das Ergebniss auf dem Bildschirm 1.5 sein 10 | -------------------------------------------------------------------------------- /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 a link to "Ruby on Rails — cucumber — GitHub":http://github.com/aslakhellesoy/cucumber/wikis/ruby-on-rails 10 | -------------------------------------------------------------------------------- /gem_tasks/deployment.rake: -------------------------------------------------------------------------------- 1 | desc 'Install the package as a gem, without generating documentation(ri/rdoc)' 2 | task :install_gem_no_doc => [:clean, :package] do 3 | sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri" 4 | end 5 | 6 | namespace :manifest do 7 | desc 'Recreate Manifest.txt to include ALL files' 8 | task :refresh do 9 | `rake check_manifest | patch -p0 > Manifest.txt` 10 | end 11 | end -------------------------------------------------------------------------------- /rails_generators/cucumber/USAGE: -------------------------------------------------------------------------------- 1 | Description: 2 | Sets up Cucumber in your Rails project. After running this generator you will 3 | get a new rake task called features. 4 | 5 | This also generates the necessary files in the features directory. 6 | 7 | Also see the feature generator, which you can use to generate skeletons 8 | for new features. 9 | 10 | Examples: 11 | `./script/generate cucumber` 12 | -------------------------------------------------------------------------------- /examples/java/src/cucumber/demo/Hello.java: -------------------------------------------------------------------------------- 1 | package cucumber.demo; 2 | 3 | public class Hello { 4 | public String greet(String who, String from) { 5 | return "Hi, " + who + ". I'm " + from; 6 | } 7 | 8 | public boolean isFriend(String who) { 9 | return true; 10 | } 11 | 12 | public String getPhoneNumber(String who) { 13 | throw new RuntimeException("NOPE"); 14 | //return "98219458"; 15 | } 16 | } -------------------------------------------------------------------------------- /examples/cs/src/demo/Calculator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Demo { 5 | public class Calculator { 6 | private Listargs = new List(); 7 | 8 | public void Push(int n) { 9 | args.Add(n); 10 | } 11 | 12 | public int Add() { 13 | int result = 0; 14 | foreach(int n in args) { 15 | result += n; 16 | } 17 | return result; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/selenium/features/step_definitons/search_steps.rb: -------------------------------------------------------------------------------- 1 | Given 'I am on the Google search page' do 2 | @browser.open('http://www.google.com/') 3 | end 4 | 5 | When /I search for "(.*)"/ do |query| 6 | @browser.type('q', query) 7 | @browser.click 'btnG' 8 | @browser.wait_for_page_to_load 9 | end 10 | 11 | Then /I should see a link to (.*)/ do |expected_url| 12 | @browser.is_element_present("css=a[href='#{expected_url}']").should be_true 13 | end 14 | -------------------------------------------------------------------------------- /examples/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /gem_tasks/gemspec.rake: -------------------------------------------------------------------------------- 1 | namespace :gemspec do 2 | desc 'Refresh cucumber.gemspec to include ALL files' 3 | task :refresh => 'manifest:refresh' do 4 | File.open('cucumber.gemspec', 'w') {|io| io.write($hoe.spec.to_ruby)} 5 | puts "1) git commit -a -m \"Release #{Cucumber::VERSION::STRING}\"" 6 | puts "2) git tag -a \"v#{Cucumber::VERSION::STRING}\" -m \"Release #{Cucumber::VERSION::STRING}\"" 7 | puts "3) git push" 8 | puts "4) git push --tags" 9 | end 10 | end -------------------------------------------------------------------------------- /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 | AN /^IN TEH END (\d+) CUCUMBRZ KTHXBAI$/ do |n| 15 | @basket.cukes.should == n.to_i 16 | end 17 | -------------------------------------------------------------------------------- /examples/tickets/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.dirname(__FILE__) + '/../../lib') 2 | require 'cucumber/rake/task' 3 | 4 | Cucumber::Rake::Task.new(:pretty) do |t| 5 | t.cucumber_opts = "--format pretty" 6 | end 7 | 8 | Cucumber::Rake::Task.new(:html) do |t| 9 | t.cucumber_opts = "--format html --out features.html" 10 | end 11 | 12 | Cucumber::Rake::Task.new(:progress) do |t| 13 | t.cucumber_opts = "--format progress -i -n" 14 | end 15 | 16 | task :default => [:pretty, :html, :progress] -------------------------------------------------------------------------------- /specs/cucumber/broadcaster_spec.rb: -------------------------------------------------------------------------------- 1 | require 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 | -------------------------------------------------------------------------------- /examples/self_test/features/background/scenario_outline_passing_background.feature: -------------------------------------------------------------------------------- 1 | Feature: Passing background with scenario outlines sample 2 | 3 | Background: 4 | Given '10' cukes 5 | 6 | Scenario Outline: passing background 7 | Then I should have '' cukes 8 | Examples: 9 | |count| 10 | | 10 | 11 | 12 | Scenario Outline: another passing background 13 | Then I should have '' cukes 14 | Examples: 15 | |count| 16 | | 10 | 17 | -------------------------------------------------------------------------------- /specs/cucumber/treetop_parser/multiline_steps.feature: -------------------------------------------------------------------------------- 1 | Feature: Multiline steps should work 2 | 3 | Scenario: Reading a table 4 | Given the following table 5 | | where | why | 6 | | Oslo | born | 7 | | London| working | 8 | Then I should be working in London 9 | And I should be born in Oslo 10 | And I should be able to expect 11 | """ 12 | A string 13 | that "indents" 14 | and spans 15 | several lines 16 | 17 | """ -------------------------------------------------------------------------------- /examples/self_test/features/background/scenario_outline_failing_background.feature: -------------------------------------------------------------------------------- 1 | Feature: Failing background with scenario outlines sample 2 | 3 | Background: 4 | Given failing without a table 5 | 6 | Scenario Outline: failing background 7 | Then I should have '' cukes 8 | Examples: 9 | |count| 10 | | 10 | 11 | 12 | Scenario Outline: another failing background 13 | Then I should have '' cukes 14 | Examples: 15 | |count| 16 | | 10 | 17 | -------------------------------------------------------------------------------- /examples/tickets/features/241.feature: -------------------------------------------------------------------------------- 1 | Users want to use cucumber, so tests are necessary to verify 2 | it is all working as expected 3 | 4 | Feature: Using the Console Formatter 5 | In order to verify this error 6 | I want to run this feature using the progress format 7 | So that it can be fixed 8 | 9 | Scenario: A normal feature 10 | Given I have a pending step 11 | When I run this feature with the progress format 12 | Then I should get a no method error for 'backtrace_line' 13 | 14 | -------------------------------------------------------------------------------- /examples/i18n/da/features/summering.feature: -------------------------------------------------------------------------------- 1 | Egenskab: Summering 2 | For at slippe for at lave dumme fejl 3 | Som en regnskabsfører 4 | Vil jeg kunne lægge sammen 5 | 6 | Scenarie: to tal 7 | Givet at jeg har indtastet 5 8 | Og at jeg har indtastet 7 9 | Når jeg summerer 10 | Så skal resultatet være 12 11 | 12 | Scenarie: tre tal 13 | Givet at jeg har indtastet 5 14 | Og at jeg har indtastet 7 15 | Og at jeg har indtastet 1 16 | Når jeg summerer 17 | Så skal resultatet være 13 -------------------------------------------------------------------------------- /specs/cucumber/ast/tags_spec.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../../spec_helper' 2 | 3 | module Cucumber 4 | module Ast 5 | describe Tags do 6 | before do 7 | @tags = Tags.new(-1, %w{one two three}) 8 | end 9 | 10 | it "should be among other tags" do 11 | @tags.should have_tags(%w{one}) 12 | end 13 | 14 | it "should not be among other tags with irrelevent tag" do 15 | @tags.should_not have_tags(%w{bacon}) 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /rails_generators/cucumber/templates/paths.rb: -------------------------------------------------------------------------------- 1 | module NavigationHelpers 2 | def path_to(page_name) 3 | case page_name 4 | 5 | when /the homepage/ 6 | root_path 7 | 8 | # Add more page name => path mappings here 9 | 10 | else 11 | raise "Can't find mapping from \"#{page_name}\" to a path.\n" + 12 | "Now, go and add a mapping in features/support/paths.rb" 13 | end 14 | end 15 | end 16 | 17 | World do |world| 18 | world.extend NavigationHelpers 19 | world 20 | end 21 | -------------------------------------------------------------------------------- /examples/i18n/se/features/summering.feature: -------------------------------------------------------------------------------- 1 | Egenskap: Summering 2 | För att slippa att göra dumma fel 3 | Som räknare 4 | Vill jag kunna lägga samman 5 | 6 | Scenario: två tal 7 | Givet att jag har knappat in 5 8 | Och att jag har knappat in 7 9 | När jag summerar 10 | Så ska resultatet vara 12 11 | 12 | Scenario: tre tal 13 | Givet att jag har knappat in 5 14 | Och att jag har knappat in 4 15 | Och att jag har knappat in 3 16 | När jag summerar 17 | Så ska resultatet vara 12 18 | -------------------------------------------------------------------------------- /examples/i18n/no/features/summering.feature: -------------------------------------------------------------------------------- 1 | Egenskap: Summering 2 | For å slippe å gjøre dumme feil 3 | Som en regnskapsfører 4 | Vil jeg kunne legge sammen 5 | 6 | Scenario: to tall 7 | Gitt at jeg har tastet inn 5 8 | Og at jeg har tastet inn 7 9 | Når jeg summerer 10 | Så skal resultatet være 12 11 | 12 | @iterasjon3 13 | Scenario: tre tall 14 | Gitt at jeg har tastet inn 5 15 | Og at jeg har tastet inn 7 16 | Og at jeg har tastet inn 1 17 | Når jeg summerer 18 | Så skal resultatet være 13 19 | -------------------------------------------------------------------------------- /examples/cs/features/step_definitons/calculator_steps.rb: -------------------------------------------------------------------------------- 1 | require 'spec/expectations' 2 | $:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project 3 | require 'Calculator' 4 | 5 | Before do 6 | @calc = Demo::Calculator.new 7 | end 8 | 9 | Given "I have entered $n into the calculator" do |n| 10 | @calc.push n.to_i 11 | end 12 | 13 | When /I press add/ do 14 | @result = @calc.Add 15 | end 16 | 17 | Then /the result should be (.*) on the screen/ do |result| 18 | @result.should == result.to_i 19 | end 20 | -------------------------------------------------------------------------------- /specs/cucumber/ast/step_collection_spec.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../../spec_helper' 2 | 3 | module Cucumber 4 | module Ast 5 | describe StepCollection do 6 | it "should convert And to Given in snippets" do 7 | c = StepCollection.new([ 8 | Step.new(1, 'Given', 'cukes'), 9 | Step.new(2, 'And', 'turnips') 10 | ]) 11 | actual_keywords = c.step_invocations.map{|i| i.actual_keyword} 12 | actual_keywords.should == %w{Given Given} 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /examples/i18n/ar/features/addition.feature: -------------------------------------------------------------------------------- 1 | خاصية: الجمع 2 | من اجل تجنب الأخطاء السخيفة 3 | كشخص غبي في الرياضيات 4 | اريد معرفة ناتج جمع عددين 5 | 6 | سيناريو مخطط: جمع عددين 7 | بفرض كتابة في الآلة الحاسبة 8 | و كتابة في الآلة الحاسبة 9 | متى يتم الضغط على