Make Capybara check the page between votes.

As pointed out in PR #2734:

"After clicking the first link, there's an AJAX request which replaces
the existing `.in-favor a` and `.against a` links with new elements. So
if Capybara tries to click the existing `.against a` link at the same
moment it's being replaced, clicking the link won't generate a new
request".

Making Capybara check the page for new content before clicking the
second link solves the problem, in the same way 4ddc869 solved the same
problem in the comments section.
This commit is contained in:
Javier Martín
2018-07-13 22:51:17 +02:00
parent 4ddc869441
commit 32504b8840

View File

@@ -83,6 +83,12 @@ feature 'Votes' do
visit debate_path(create(:debate))
find('.in-favor a').click
within('.in-favor') do
expect(page).to have_content "100%"
expect(page).to have_css("a.voted")
end
find('.against a').click
within('.in-favor') do