From 6f7a6dcf3b45348aaa71272fe78fa68e9363b700 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 14 Sep 2015 13:11:47 +0200 Subject: [PATCH] removes possibility of taking away support for proposals --- app/models/proposal.rb | 5 +---- spec/features/votes_spec.rb | 18 ++---------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/app/models/proposal.rb b/app/models/proposal.rb index ab31a8b70..913b23fcc 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -75,10 +75,7 @@ class Proposal < ActiveRecord::Base end def register_vote(user, vote_value) - return unless votable_by?(user) - if user.voted_for?(self) - unvote_by(user) - else + if votable_by?(user) vote_by(voter: user, vote: vote_value) end end diff --git a/spec/features/votes_spec.rb b/spec/features/votes_spec.rb index b98cf2031..75377a3de 100644 --- a/spec/features/votes_spec.rb +++ b/spec/features/votes_spec.rb @@ -452,20 +452,6 @@ feature 'Votes' do end end - scenario 'Update', :js do - visit proposal_path(@proposal) - - within('.supports') do - find('.in-favor a').click - expect(page).to have_content "1 support" - expect(page).to have_css("a.voted") - - find('.in-favor a').click - expect(page).to have_content "No supports" - expect(page).to_not have_css("a.no-voted") - end - end - scenario 'Trying to vote multiple times', :js do visit proposal_path(@proposal) @@ -484,7 +470,7 @@ feature 'Votes' do visit proposal_path(@proposal) within('.supports') do - expect(page).to have_content "2 supports / 53.726" + expect(page).to have_content "2 supports" end end @@ -569,5 +555,5 @@ feature 'Votes' do end end - xscenario "Remove support button text - tested in Update spec" + xscenario "Change button text after voting" end \ No newline at end of file