Remove unused vote extensions methods

These methods aren't used since commit b98244afd.
This commit is contained in:
Javi Martín
2022-04-05 22:28:20 +02:00
parent 4be609bc6d
commit c25ab8e4a6
2 changed files with 0 additions and 38 deletions

View File

@@ -13,18 +13,6 @@ ActsAsVotable::Vote.class_eval do
Comment.public_for_api.pluck(:id)) Comment.public_for_api.pluck(:id))
end end
def self.for_debates(debates)
where(votable_type: "Debate", votable_id: debates)
end
def self.for_proposals(proposals)
where(votable_type: "Proposal", votable_id: proposals)
end
def self.for_legislation_proposals(proposals)
where(votable_type: "Legislation::Proposal", votable_id: proposals)
end
def self.for_budget_investments(budget_investments = Budget::Investment.all) def self.for_budget_investments(budget_investments = Budget::Investment.all)
where(votable_type: "Budget::Investment", votable_id: budget_investments) where(votable_type: "Budget::Investment", votable_id: budget_investments)
end end

View File

@@ -1,32 +1,6 @@
require "rails_helper" require "rails_helper"
describe Vote do describe Vote do
describe "#for_debates" do
it "does not returns votes for other votables" do
debate = create(:debate)
create(:vote, votable: create(:comment))
expect(Vote.for_debates(debate).count).to eq(0)
end
it "returns votes only for debates in parameters" do
debate1 = create(:debate, voters: [create(:user)])
debate2 = create(:debate)
expect(Vote.for_debates(debate1).count).to eq(1)
expect(Vote.for_debates(debate2).count).to eq(0)
end
it "accepts more than 1 debate" do
debate1 = create(:debate, voters: [create(:user)])
debate2 = create(:debate)
debate3 = create(:debate, voters: [create(:user)])
expect(Vote.for_debates([debate1, debate2]).count).to eq(1)
expect(Vote.for_debates([debate1, debate3]).count).to eq(2)
end
end
describe "#value" do describe "#value" do
it "returns vote flag" do it "returns vote flag" do
vote = create(:vote, vote_flag: true) vote = create(:vote, vote_flag: true)