From 81fe41bc5f6f89bb31afede94664db938d997165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aslak=20Helles=C3=B8y?= Date: Tue, 30 Sep 2008 07:50:05 +0200 Subject: [PATCH] Allow several tables in the same feature [#16 state:resolved] --- Manifest.txt | 1 + cucumber.gemspec | 2 +- .../treetop_parser/feature_parser_spec.rb | 7 +++++ .../treetop_parser/multiple_tables.feature | 27 +++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 spec/cucumber/treetop_parser/multiple_tables.feature diff --git a/Manifest.txt b/Manifest.txt index 71854fd95cb..488b13dd3bb 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -143,6 +143,7 @@ spec/cucumber/treetop_parser/empty_scenario.feature spec/cucumber/treetop_parser/feature_parser_spec.rb spec/cucumber/treetop_parser/fit_scenario.feature spec/cucumber/treetop_parser/given_scenario.feature +spec/cucumber/treetop_parser/multiple_tables.feature spec/cucumber/treetop_parser/spaces.feature spec/cucumber/treetop_parser/with_comments.feature spec/spec.opts diff --git a/cucumber.gemspec b/cucumber.gemspec index de51ee45744..3807060bc29 100644 --- a/cucumber.gemspec +++ b/cucumber.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.email = ["aslak.hellesoy@gmail.com"] s.executables = ["cucumber"] s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "TODO.txt"] - s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "TODO.txt", "bin/cucumber", "config/hoe.rb", "config/requirements.rb", "cucumber.yml", "examples/calculator/Rakefile", "examples/calculator/cucumber.yml", "examples/calculator/features/addition.feature", "examples/calculator/features/division.feature", "examples/calculator/features/steps/calculator_steps.rb", "examples/calculator/lib/calculator.rb", "examples/calculator_ruby_features/Rakefile", "examples/calculator_ruby_features/features/addition.rb", "examples/calculator_ruby_features/features/steps/calculator_steps.rb", "examples/calculatrice_francaise_avec_soit_scenario/Rakefile", "examples/calculatrice_francaise_avec_soit_scenario/features/addition.feature", "examples/calculatrice_francaise_avec_soit_scenario/features/calculatrice_steps.rb", "examples/cs/README.textile", "examples/cs/Rakefile", "examples/cs/features/hello.feature", "examples/cs/features/steps/hello_steps.rb", "examples/cs/features/steps/tree_steps.rb", "examples/cs/features/tree.feature", "examples/cs/src/Hello.cs", "examples/danish_calculator/Rakefile", "examples/danish_calculator/features/steps/kalkulator_steps.rb", "examples/danish_calculator/features/summering.feature", "examples/danish_calculator/lib/kalkulator.rb", "examples/estonian_calculator/Rakefile", "examples/estonian_calculator/features/kalkulaator_steps.rb", "examples/estonian_calculator/features/liitmine.feature", "examples/java/README.textile", "examples/java/Rakefile", "examples/java/features/hello.feature", "examples/java/features/steps/hello_steps.rb", "examples/java/features/steps/tree_steps.rb", "examples/java/features/tree.feature", "examples/java/src/cucumber/demo/Hello.java", "examples/norwegian_calculator/Rakefile", "examples/norwegian_calculator/features/steps/kalkulator_steps.rb", "examples/norwegian_calculator/features/summering.feature", "examples/norwegian_calculator/lib/kalkulator.rb", "examples/portuguese_calculator/Rakefile", "examples/portuguese_calculator/features/adicao.feature", "examples/portuguese_calculator/features/calculadora_steps.rb", "examples/selenium/Rakefile", "examples/selenium/features/search.feature", "examples/selenium/features/steps/stories_steps.rb", "examples/spanish_calculator/Rakefile", "examples/spanish_calculator/features/adicion.feature", "examples/spanish_calculator/features/steps/calculador_steps.rb", "examples/spanish_calculator/lib/Calculador.rb", "examples/tickets/Rakefile", "examples/tickets/features/steps/tickets_steps.rb", "examples/tickets/features/tickets.feature", "examples/watir/Rakefile", "examples/watir/features/search.feature", "examples/watir/features/steps/stories_steps.rb", "features/see_features.feature", "features/steps/features_steps.rb", "gem_tasks/deployment.rake", "gem_tasks/environment.rake", "gem_tasks/features.rake", "gem_tasks/fix_cr_lf.rake", "gem_tasks/flog.rake", "gem_tasks/gemspec.rake", "gem_tasks/rspec.rake", "gem_tasks/treetop.rake", "generators/cucumber/cucumber_generator.rb", "generators/cucumber/templates/common_webrat.rb", "generators/cucumber/templates/cucumber", "generators/cucumber/templates/cucumber.rake", "generators/cucumber/templates/env.rb", "generators/feature/feature_generator.rb", "generators/feature/templates/feature.erb", "generators/feature/templates/steps.erb", "lib/cucumber.rb", "lib/cucumber/cli.rb", "lib/cucumber/core_ext/proc.rb", "lib/cucumber/core_ext/string.rb", "lib/cucumber/executor.rb", "lib/cucumber/formatters.rb", "lib/cucumber/formatters/ansicolor.rb", "lib/cucumber/formatters/cucumber.css", "lib/cucumber/formatters/cucumber.js", "lib/cucumber/formatters/html_formatter.rb", "lib/cucumber/formatters/jquery.js", "lib/cucumber/formatters/pretty_formatter.rb", "lib/cucumber/formatters/progress_formatter.rb", "lib/cucumber/languages.yml", "lib/cucumber/rails/rspec.rb", "lib/cucumber/rails/world.rb", "lib/cucumber/rake/task.rb", "lib/cucumber/step_methods.rb", "lib/cucumber/step_mother.rb", "lib/cucumber/tree.rb", "lib/cucumber/tree/feature.rb", "lib/cucumber/tree/features.rb", "lib/cucumber/tree/given_scenario.rb", "lib/cucumber/tree/scenario.rb", "lib/cucumber/tree/step.rb", "lib/cucumber/tree/table.rb", "lib/cucumber/tree/top_down_visitor.rb", "lib/cucumber/treetop_parser/feature.treetop.erb", "lib/cucumber/treetop_parser/feature_da.rb", "lib/cucumber/treetop_parser/feature_de.rb", "lib/cucumber/treetop_parser/feature_en.rb", "lib/cucumber/treetop_parser/feature_es.rb", "lib/cucumber/treetop_parser/feature_et.rb", "lib/cucumber/treetop_parser/feature_fr.rb", "lib/cucumber/treetop_parser/feature_no.rb", "lib/cucumber/treetop_parser/feature_parser.rb", "lib/cucumber/treetop_parser/feature_pt.rb", "lib/cucumber/treetop_parser/feature_ru.rb", "lib/cucumber/treetop_parser/feature_se.rb", "lib/cucumber/version.rb", "script/console", "script/console.cmd", "script/destroy", "script/destroy.cmd", "script/generate", "script/generate.cmd", "script/txt2html", "script/txt2html.cmd", "setup.rb", "spec/cucumber/cli_spec.rb", "spec/cucumber/core_ext/proc_spec.rb", "spec/cucumber/core_ext/string_spec.rb", "spec/cucumber/executor_spec.rb", "spec/cucumber/formatters/ansicolor_spec.rb", "spec/cucumber/formatters/features.html", "spec/cucumber/formatters/html_formatter_spec.rb", "spec/cucumber/formatters/progress_formatter_spec.rb", "spec/cucumber/sell_cucumbers.feature", "spec/cucumber/step_mother_spec.rb", "spec/cucumber/tree/scenario_spec.rb", "spec/cucumber/treetop_parser/feature_parser_spec.rb", "spec/cucumber/treetop_parser/fit_scenario.feature", "spec/cucumber/treetop_parser/given_scenario.feature", "spec/cucumber/treetop_parser/spaces.feature", "spec/cucumber/treetop_parser/with_comments.feature", "spec/spec.opts", "spec/spec_helper.rb"] + s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "TODO.txt", "bin/cucumber", "config/hoe.rb", "config/requirements.rb", "cucumber.yml", "examples/calculator/Rakefile", "examples/calculator/cucumber.yml", "examples/calculator/features/addition.feature", "examples/calculator/features/division.feature", "examples/calculator/features/steps/calculator_steps.rb", "examples/calculator/lib/calculator.rb", "examples/calculator_ruby_features/Rakefile", "examples/calculator_ruby_features/features/addition.rb", "examples/calculator_ruby_features/features/steps/calculator_steps.rb", "examples/calculatrice_francaise_avec_soit_scenario/Rakefile", "examples/calculatrice_francaise_avec_soit_scenario/features/addition.feature", "examples/calculatrice_francaise_avec_soit_scenario/features/calculatrice_steps.rb", "examples/cs/README.textile", "examples/cs/Rakefile", "examples/cs/features/hello.feature", "examples/cs/features/steps/hello_steps.rb", "examples/cs/features/steps/tree_steps.rb", "examples/cs/features/tree.feature", "examples/cs/src/Hello.cs", "examples/danish_calculator/Rakefile", "examples/danish_calculator/features/steps/kalkulator_steps.rb", "examples/danish_calculator/features/summering.feature", "examples/danish_calculator/lib/kalkulator.rb", "examples/estonian_calculator/Rakefile", "examples/estonian_calculator/features/kalkulaator_steps.rb", "examples/estonian_calculator/features/liitmine.feature", "examples/java/README.textile", "examples/java/Rakefile", "examples/java/features/hello.feature", "examples/java/features/steps/hello_steps.rb", "examples/java/features/steps/tree_steps.rb", "examples/java/features/tree.feature", "examples/java/src/cucumber/demo/Hello.java", "examples/norwegian_calculator/Rakefile", "examples/norwegian_calculator/features/steps/kalkulator_steps.rb", "examples/norwegian_calculator/features/summering.feature", "examples/norwegian_calculator/lib/kalkulator.rb", "examples/portuguese_calculator/Rakefile", "examples/portuguese_calculator/features/adicao.feature", "examples/portuguese_calculator/features/calculadora_steps.rb", "examples/selenium/Rakefile", "examples/selenium/features/search.feature", "examples/selenium/features/steps/stories_steps.rb", "examples/spanish_calculator/Rakefile", "examples/spanish_calculator/features/adicion.feature", "examples/spanish_calculator/features/steps/calculador_steps.rb", "examples/spanish_calculator/lib/Calculador.rb", "examples/tickets/Rakefile", "examples/tickets/features/steps/tickets_steps.rb", "examples/tickets/features/tickets.feature", "examples/watir/Rakefile", "examples/watir/features/search.feature", "examples/watir/features/steps/stories_steps.rb", "features/see_features.feature", "features/steps/features_steps.rb", "gem_tasks/deployment.rake", "gem_tasks/environment.rake", "gem_tasks/features.rake", "gem_tasks/fix_cr_lf.rake", "gem_tasks/flog.rake", "gem_tasks/gemspec.rake", "gem_tasks/rspec.rake", "gem_tasks/treetop.rake", "generators/cucumber/cucumber_generator.rb", "generators/cucumber/templates/common_webrat.rb", "generators/cucumber/templates/cucumber", "generators/cucumber/templates/cucumber.rake", "generators/cucumber/templates/env.rb", "generators/feature/feature_generator.rb", "generators/feature/templates/feature.erb", "generators/feature/templates/steps.erb", "lib/cucumber.rb", "lib/cucumber/cli.rb", "lib/cucumber/core_ext/proc.rb", "lib/cucumber/core_ext/string.rb", "lib/cucumber/executor.rb", "lib/cucumber/formatters.rb", "lib/cucumber/formatters/ansicolor.rb", "lib/cucumber/formatters/cucumber.css", "lib/cucumber/formatters/cucumber.js", "lib/cucumber/formatters/html_formatter.rb", "lib/cucumber/formatters/jquery.js", "lib/cucumber/formatters/pretty_formatter.rb", "lib/cucumber/formatters/progress_formatter.rb", "lib/cucumber/languages.yml", "lib/cucumber/rails/rspec.rb", "lib/cucumber/rails/world.rb", "lib/cucumber/rake/task.rb", "lib/cucumber/step_methods.rb", "lib/cucumber/step_mother.rb", "lib/cucumber/tree.rb", "lib/cucumber/tree/feature.rb", "lib/cucumber/tree/features.rb", "lib/cucumber/tree/given_scenario.rb", "lib/cucumber/tree/scenario.rb", "lib/cucumber/tree/step.rb", "lib/cucumber/tree/table.rb", "lib/cucumber/tree/top_down_visitor.rb", "lib/cucumber/treetop_parser/feature.treetop.erb", "lib/cucumber/treetop_parser/feature_da.rb", "lib/cucumber/treetop_parser/feature_de.rb", "lib/cucumber/treetop_parser/feature_en.rb", "lib/cucumber/treetop_parser/feature_es.rb", "lib/cucumber/treetop_parser/feature_et.rb", "lib/cucumber/treetop_parser/feature_fr.rb", "lib/cucumber/treetop_parser/feature_no.rb", "lib/cucumber/treetop_parser/feature_parser.rb", "lib/cucumber/treetop_parser/feature_pt.rb", "lib/cucumber/treetop_parser/feature_ru.rb", "lib/cucumber/treetop_parser/feature_se.rb", "lib/cucumber/version.rb", "script/console", "script/console.cmd", "script/destroy", "script/destroy.cmd", "script/generate", "script/generate.cmd", "script/txt2html", "script/txt2html.cmd", "setup.rb", "spec/cucumber/cli_spec.rb", "spec/cucumber/core_ext/proc_spec.rb", "spec/cucumber/core_ext/string_spec.rb", "spec/cucumber/executor_spec.rb", "spec/cucumber/formatters/ansicolor_spec.rb", "spec/cucumber/formatters/features.html", "spec/cucumber/formatters/html_formatter_spec.rb", "spec/cucumber/formatters/progress_formatter_spec.rb", "spec/cucumber/sell_cucumbers.feature", "spec/cucumber/step_mother_spec.rb", "spec/cucumber/tree/scenario_spec.rb", "spec/cucumber/treetop_parser/empty_scenario.feature", "spec/cucumber/treetop_parser/feature_parser_spec.rb", "spec/cucumber/treetop_parser/fit_scenario.feature", "spec/cucumber/treetop_parser/given_scenario.feature", "spec/cucumber/treetop_parser/spaces.feature", "spec/cucumber/treetop_parser/with_comments.feature", "spec/spec.opts", "spec/spec_helper.rb"] s.has_rdoc = true s.homepage = %q{http://github.com/aslakhellesoy/cucumber} s.rdoc_options = ["--main", "README.txt"] diff --git a/spec/cucumber/treetop_parser/feature_parser_spec.rb b/spec/cucumber/treetop_parser/feature_parser_spec.rb index fb364a9c3fc..baac4ec2677 100644 --- a/spec/cucumber/treetop_parser/feature_parser_spec.rb +++ b/spec/cucumber/treetop_parser/feature_parser_spec.rb @@ -73,6 +73,13 @@ def self.visit_step(s) f.scenarios[1].should have(0).steps f.scenarios[2].should have(1).steps end + + it "should allow multiple tables" do + p = FeatureParser.new + f = p.parse_feature(File.dirname(__FILE__) + '/multiple_tables.feature') + f.should have(6).scenarios + f.scenarios[0].should have(5).steps + end end end diff --git a/spec/cucumber/treetop_parser/multiple_tables.feature b/spec/cucumber/treetop_parser/multiple_tables.feature new file mode 100644 index 00000000000..d77c6aa8360 --- /dev/null +++ b/spec/cucumber/treetop_parser/multiple_tables.feature @@ -0,0 +1,27 @@ +Feature: Addition + In order to avoid silly mistakes + As a math idiot + I want to be told the sum of two numbers + + Scenario: Add two numbers + Given I have entered 50 into the calculator + And I have entered 70 into the calculator + When I press add + Then the result should be 120 on the screen + And the result class should be Fixnum + + | input_1 | input_2 | button | output | class | + | 20 | 30 | add | 50 | Fixnum | + | 2 | 5 | add | 7 | Fixnum | + | 0 | 40 | add | 40 | Fixnum | + + Scenario: Add three numbers + Given I have entered 25 into the calculator + And I have entered 12 into the calculator + And I have entered 13 into the calculator + When I press add + Then the result should be 50 on the screen + And the result class should be Fixnum + + | input_1 | input_2 | input_3 | button | output | class | + | 1 | 2 | 3 | add | 6 | Fixnum |