removes possibility of taking away support for proposals

This commit is contained in:
rgarcia
2015-09-14 13:11:47 +02:00
parent 220c611927
commit 6f7a6dcf3b
2 changed files with 3 additions and 20 deletions

View File

@@ -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

View File

@@ -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