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

24 lines
622 B
Ruby
Raw Normal View History

2016-03-07 19:52:19 -05:00
# frozen_string_literal: true
2018-01-08 15:23:54 -05:00
2017-01-26 19:10:51 -05:00
When(/^I visit the (?:root|home) page$/) do
visit('/')
end
2017-01-26 19:10:51 -05:00
Then(/^I should see "([^"]*)"$/) do |text|
expect(page).to have_content(text)
end
2017-01-26 19:10:51 -05:00
Then(/^Capybara should use the "([^"]*)" driver$/) do |driver|
expect(Capybara.current_driver).to eq(driver.to_sym)
end
2017-01-26 19:10:51 -05:00
When(/^I use a matcher that fails$/) do
2019-12-22 14:02:00 -05:00
expect(page).to have_css('h1#doesnotexist')
rescue StandardError, RSpec::Expectations::ExpectationNotMetError => e
@error_message = e.message
end
2017-01-26 19:10:51 -05:00
Then(/^the failing exception should be nice$/) do
2020-06-01 14:34:52 -04:00
expect(@error_message).to match(/expected to find css "h1#doesnotexist"/)
end