I have a RSpec test that keeps failing.
subject { page }
visit user_path(user)
it { should have_link('Settings', href: edit_user_path(user)) }
But when I load the page myself I can see that the link is working well. Any ideas ? No spelling mistake as well.
Possible to see the page that RSpec loaded in the test?
Your visit user_path(user)
isn't executing in the right context.
Try either:
subject { page }
it do
visit user_path(user)
should have_link('Settings', href: edit_user_path(user))
end
Or:
subject { page }
before { visit user_path(user) }
it { should have_link('Settings', href: edit_user_path(user)) }
If you would like to see the html, you can use a save_and_open_page
statement.
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