From 7fd773773adfbd59c15ed53b3c459f0329eae34b Mon Sep 17 00:00:00 2001 From: taitus Date: Thu, 25 May 2023 11:10:24 +0200 Subject: [PATCH] Unify votes specs --- spec/system/votes_spec.rb | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/spec/system/votes_spec.rb b/spec/system/votes_spec.rb index 294d91bc7..83ca2f305 100644 --- a/spec/system/votes_spec.rb +++ b/spec/system/votes_spec.rb @@ -74,9 +74,11 @@ describe "Votes" do end end - scenario "Update" do + scenario "Create and update from debate show" do visit debate_path(create(:debate)) + expect(page).to have_content "No votes" + click_button "I agree" within(".in-favor") do @@ -84,6 +86,13 @@ describe "Votes" do expect(page).to have_button class: "voted" end + within(".against") do + expect(page).to have_content "0%" + expect(page).to have_css("button.no-voted") + end + + expect(page).to have_content "1 vote" + click_button "I disagree" within(".in-favor") do @@ -136,24 +145,6 @@ describe "Votes" do end end - scenario "Create from debate show" do - visit debate_path(create(:debate)) - - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "100%" - expect(page).to have_button class: "voted" - end - - within(".against") do - expect(page).to have_content "0%" - expect(page).to have_button class: "no-voted" - end - - expect(page).to have_content "1 vote" - end - scenario "Create in index" do create(:debate) visit debates_path