1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Use customer RSpec matchers in cucumber

This commit is contained in:
Jonas Nicklas 2011-02-06 14:44:43 +01:00
parent d03fba859b
commit 6d409dcf53
3 changed files with 20 additions and 0 deletions

View file

@ -16,3 +16,8 @@ Feature: Capybara's cucumber integration
Scenario: selenium tag
When I visit the root page
Then Capybara should use the "selenium" driver
Scenario: matchers
When I visit the root page
And I use a matcher that fails
Then the failing exception should be nice

View file

@ -9,3 +9,16 @@ end
Then /^Capybara should use the "([^"]*)" driver$/ do |driver|
Capybara.current_driver.should == driver.to_sym
end
When /^I use a matcher that fails$/ do
begin
page.should have_css('h1#doesnotexist')
rescue StandardError => e
@error_message = e.message
end
end
Then /^the failing exception should be nice$/ do
@error_message.should =~ %r(expected css \"h1#doesnotexist\" to return)
end

View file

@ -1,7 +1,9 @@
require 'capybara'
require 'capybara/dsl'
require 'capybara/rspec_matchers'
World(Capybara)
World(Capybara::RSpecMatchers)
After do
Capybara.reset_sessions!