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
|
2011-02-06 08:34:32 -05:00
|
|
|
visit('/')
|
|
|
|
end
|
|
|
|
|
2017-01-26 19:10:51 -05:00
|
|
|
Then(/^I should see "([^"]*)"$/) do |text|
|
2013-11-14 12:43:36 -05:00
|
|
|
expect(page).to have_content(text)
|
2011-02-06 08:34:32 -05:00
|
|
|
end
|
|
|
|
|
2017-01-26 19:10:51 -05:00
|
|
|
Then(/^Capybara should use the "([^"]*)" driver$/) do |driver|
|
2013-11-14 12:43:36 -05:00
|
|
|
expect(Capybara.current_driver).to eq(driver.to_sym)
|
2011-02-06 08:34:32 -05:00
|
|
|
end
|
2011-02-06 08:44:43 -05:00
|
|
|
|
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
|
2011-02-06 08:44:43 -05:00
|
|
|
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"/)
|
2011-02-06 08:44:43 -05:00
|
|
|
end
|