From ef2b2317e5097585e0861b0ec867e8829ffa255f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 9 Oct 2019 21:57:20 +0200 Subject: [PATCH] Fix flaky officing results spec The page could have "7777" as a content for the poll's name, since that name is generated using a random hexadecimal number. Restricting the search to the area of the page where the "7777" used to be solves the problem. --- spec/features/officing/results_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/features/officing/results_spec.rb b/spec/features/officing/results_spec.rb index 61c2cbb0f..241788691 100644 --- a/spec/features/officing/results_spec.rb +++ b/spec/features/officing/results_spec.rb @@ -111,7 +111,11 @@ describe "Officing Results", :with_frozen_time do click_link "See results" end - expect(page).not_to have_content("7777") + within("#question_#{question_1.id}_0_result") do + expect(page).to have_content("5555") + expect(page).not_to have_content("7777") + end + within("#white_results") { expect(page).to have_content("6") } within("#null_results") { expect(page).to have_content("7") } within("#total_results") { expect(page).to have_content("8") }