Reputation: 24560
I am trying to test with has_link? in my spec test, here is my test:
page.has_link?('next_page', {}).should == true
but, the test always fail, although the link with id 'next_page' dose exist! the strange thing is that have_content always works fine, here is how I implement it:
page.should have_content("some text")
Can you help me please ? what I am missing here ?
EDIT
Here is the resulted link in the page:
<a id="next_page" href="javascript: void(0)" onclick="javascript: void(0)" style="color: #888888">Next</a>
Upvotes: 1
Views: 3968
Reputation: 2368
You can try below sample -
it "should have logout link" do
expect(page).to have_link('Logout')
end
Upvotes: 1
Reputation: 5453
I do this with:
rendered.should have_link("Teams", :href => teams_path)
Upvotes: 0
Reputation: 841
I think you should do :
page.has_link? "next_page"
or
page.has_link? "next_page", url_path
Upvotes: 7