From 75d2782061e96f44aed21040dbc1f12e47b26b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 19 Jul 2023 21:12:40 +0200 Subject: [PATCH] Make investment votes abilities tests consistent Now both the tests to create and destroy use the `user.votes` association. --- spec/models/abilities/common_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/models/abilities/common_spec.rb b/spec/models/abilities/common_spec.rb index af7d7cb8c..92fab9aba 100644 --- a/spec/models/abilities/common_spec.rb +++ b/spec/models/abilities/common_spec.rb @@ -265,9 +265,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 be_able_to(:destroy, user.votes.create!(votable: investment_in_selecting_budget)) } + it { should_not be_able_to(:destroy, user.votes.create!(votable: investment_in_accepting_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_reviewing_budget) }