Make content assertion order-independent

This commit is contained in:
Marko Lovic
2018-07-10 09:24:37 +02:00
committed by decabeza
parent 4a2fae5e90
commit 3c9953e9e0

View File

@@ -142,7 +142,10 @@ feature 'Votes' do
within("#budget_investment_#{third_heading_investment.id}") do
find('.in-favor a').click
expect(page).to have_content "You can only support investment projects in 2 districts. You have already supported investments in #{new_york.name} and #{san_francisco.name}"
expect(page).to have_content "You can only support investment projects in 2 districts. You have already supported investments in"
heading_names = find('.participation-not-allowed').text.match(/You have already supported investments in (.+) and (.+)\./)&.captures
expect(heading_names).to match_array [new_york.name, san_francisco.name]
expect(page).not_to have_content "1 support"
expect(page).not_to have_content "You have already supported this investment project. Share it!"
@@ -165,7 +168,10 @@ feature 'Votes' do
visit budget_investment_path(budget, third_heading_investment)
find('.in-favor a').click
expect(page).to have_content "You can only support investment projects in 2 districts. You have already supported investments in #{new_york.name} and #{san_francisco.name}"
expect(page).to have_content "You can only support investment projects in 2 districts. You have already supported investments in"
heading_names = find('.participation-not-allowed').text.match(/You have already supported investments in (.+) and (.+)\./)&.captures
expect(heading_names).to match_array [new_york.name, san_francisco.name]
expect(page).not_to have_content "1 support"
expect(page).not_to have_content "You have already supported this investment project. Share it!"