Allow users to remove their support on investments
Note we don't cast negative votes when users remove their support. That way we provide compatibility for institutions who have implemented real negative votes (in case there are / will be any), and we also keep the database meaningful: it's not that users downvoted something; they simply removed their upvote. Co-Authored-By: Javi Martín <javim@elretirao.net> Co-Authored-By: Julian Nicolas Herrero <microweb10@gmail.com>
This commit is contained in:
@@ -251,6 +251,9 @@ describe Abilities::Common do
|
||||
it { should be_able_to(:create, user.votes.build(votable: investment_in_selecting_budget)) }
|
||||
it { should_not be_able_to(:create, user.votes.build(votable: investment_in_accepting_budget)) }
|
||||
it { should_not be_able_to(:create, user.votes.build(votable: investment_in_balloting_budget)) }
|
||||
it { should be_able_to(:destroy, create(:vote, voter: user, votable: investment_in_selecting_budget)) }
|
||||
it { should_not be_able_to(:destroy, create(:vote, voter: user, votable: investment_in_accepting_budget)) }
|
||||
it { should_not be_able_to(:destroy, create(:vote, voter: user, votable: investment_in_balloting_budget)) }
|
||||
|
||||
it { should_not be_able_to(:destroy, investment_in_accepting_budget) }
|
||||
it { should_not be_able_to(:destroy, investment_in_reviewing_budget) }
|
||||
|
||||
Reference in New Issue
Block a user