diff --git a/Gemfile.lock b/Gemfile.lock index a94350dd..015695ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,10 +20,17 @@ PATH GEM remote: http://rubygems.org/ specs: + builder (3.0.0) celerity (0.8.7) childprocess (0.1.6) ffi (~> 0.6.3) configuration (1.2.0) + cucumber (0.10.0) + builder (>= 2.1.2) + diff-lcs (~> 1.1.2) + gherkin (~> 2.3.2) + json (~> 1.4.6) + term-ansicolor (~> 1.0.5) culerity (0.2.15) diff-lcs (1.1.2) ffi (0.6.3) @@ -33,6 +40,12 @@ GEM rspec (~> 2.0) rspec-instafail (~> 0.1.4) ruby-progressbar (~> 0.0.9) + gherkin (2.3.3) + json (~> 1.4.6) + gherkin (2.3.3-java) + json (~> 1.4.6) + json (1.4.6) + json (1.4.6-java) json_pure (1.4.6) launchy (0.3.7) configuration (>= 0.0.5) @@ -64,6 +77,7 @@ GEM sinatra (1.1.2) rack (~> 1.1) tilt (~> 1.2) + term-ansicolor (1.0.5) tilt (1.2.2) weakling (0.0.4-java) yard (0.6.4) @@ -76,6 +90,7 @@ DEPENDENCIES bundler (~> 1.0) capybara! celerity (>= 0.7.9) + cucumber (>= 0.10) culerity (>= 0.2.4) fuubar (>= 0.0.1) launchy (>= 0.3.5) diff --git a/capybara.gemspec b/capybara.gemspec index c27a21b1..ba6d71d0 100644 --- a/capybara.gemspec +++ b/capybara.gemspec @@ -36,4 +36,5 @@ Gem::Specification.new do |s| s.add_development_dependency("launchy", [">= 0.3.5"]) s.add_development_dependency("yard", [">= 0.5.8"]) s.add_development_dependency("fuubar", [">= 0.0.1"]) + s.add_development_dependency("cucumber", [">= 0.10"]) end diff --git a/features/capybara.feature b/features/capybara.feature new file mode 100644 index 00000000..c922a23d --- /dev/null +++ b/features/capybara.feature @@ -0,0 +1,18 @@ +Feature: Capybara's cucumber integration + In order to integrate with the lovely plain text testing framework + As Capybara + I want to integrate successfully with Cucumber + + Scenario: hello world + When I visit the root page + Then I should see "Hello world!" + + @javascript + Scenario: javascript tag + When I visit the root page + Then Capybara should use the "selenium" driver + + @selenium + Scenario: selenium tag + When I visit the root page + Then Capybara should use the "selenium" driver diff --git a/features/step_definitions/capybara_steps.rb b/features/step_definitions/capybara_steps.rb new file mode 100644 index 00000000..4bd989d3 --- /dev/null +++ b/features/step_definitions/capybara_steps.rb @@ -0,0 +1,11 @@ +When /^I visit the root page$/ do + visit('/') +end + +Then /^I should see "([^"]*)"$/ do |text| + page.should have_content(text) +end + +Then /^Capybara should use the "([^"]*)" driver$/ do |driver| + Capybara.current_driver.should == driver.to_sym +end diff --git a/features/support/env.rb b/features/support/env.rb new file mode 100644 index 00000000..ea3f0bff --- /dev/null +++ b/features/support/env.rb @@ -0,0 +1,7 @@ +require 'rubygems' +require 'bundler/setup' + +require 'capybara/cucumber' +require 'capybara/spec/test_app' + +Capybara.app = TestApp