In The training wheels came off post by Aslak Hellesoy he says he has removed web_steps.rb and paths.rb from more recent versions of cucumber.
I can understand using the Capybara api instead of web_steps.rb, but how would you now test that you are on a specific page?
This is how I used to do it with paths.rb:
#admin_authentication.feature
Then I should be on the admin home page
# paths.rb
when /the admin home page/
admin_root_path
# web_steps.rb
Then /^(?:|I )should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
if current_path.respond_to? :should
current_path.should == path_to(page_name)
else
assert_equal path_to(page_name), current_path
end
end
As a secondary question, should we be doing this at all?
I simply do like this, see if it works for you:
assert page.current_path == admin_root_path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With