From 559f842e68cf216728f56be89bc2baaef11fccb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 10 Apr 2021 14:49:16 +0200 Subject: [PATCH] Make account recommendations spec more robust We check the changes have been saved and we check recommendations have been disabled after visiting the debates and proposals pages. The latter helps us avoid accessing the database after the process running the browser has been started. --- spec/system/account_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/system/account_spec.rb b/spec/system/account_spec.rb index 68ebba52c..31f3a75a7 100644 --- a/spec/system/account_spec.rb +++ b/spec/system/account_spec.rb @@ -198,13 +198,18 @@ describe "Account" do click_button "Save changes" + expect(page).to have_content "Changes saved" + expect(find("#account_recommended_debates")).not_to be_checked expect(find("#account_recommended_proposals")).not_to be_checked - user.reload + visit debates_path - expect(user.recommended_debates).to be(false) - expect(user.recommended_proposals).to be(false) + expect(page).not_to have_link("recommendations") + + visit proposals_path + + expect(page).not_to have_link("recommendations") end end end