Make investment votes abilities tests consistent

Now both the tests to create and destroy use the `user.votes`
association.
This commit is contained in:
Javi Martín
2023-07-19 21:12:40 +02:00
parent 3fe292dfe2
commit 75d2782061

View File

@@ -265,9 +265,9 @@ describe Abilities::Common do
it { should be_able_to(:create, user.votes.build(votable: investment_in_selecting_budget)) } 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_accepting_budget)) }
it { should_not be_able_to(:create, user.votes.build(votable: investment_in_balloting_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 be_able_to(:destroy, user.votes.create!(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, user.votes.create!(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, user.votes.create!(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_accepting_budget) }
it { should_not be_able_to(:destroy, investment_in_reviewing_budget) } it { should_not be_able_to(:destroy, investment_in_reviewing_budget) }