Remove unused vote extensions methods
These methods aren't used since commit b98244afd.
This commit is contained in:
@@ -13,18 +13,6 @@ ActsAsVotable::Vote.class_eval do
|
||||
Comment.public_for_api.pluck(:id))
|
||||
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)
|
||||
where(votable_type: "Budget::Investment", votable_id: budget_investments)
|
||||
end
|
||||
|
||||
@@ -1,32 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
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
|
||||
it "returns vote flag" do
|
||||
vote = create(:vote, vote_flag: true)
|
||||
|
||||
Reference in New Issue
Block a user