uses proposal total_votes for % helper methods

This commit is contained in:
Juanjo Bazán
2015-12-18 13:15:00 +01:00
parent 3f195d6234
commit cf271fe33a
2 changed files with 12 additions and 2 deletions

View File

@@ -13,6 +13,11 @@ describe ProposalsHelper do
expect(progress_bar_percentage(proposal)).to eq 50
end
it "should take into account the physical votes" do
proposal = create(:proposal, cached_votes_up: ((Proposal.votes_needed_for_success/2)-100), physical_votes: 100)
expect(progress_bar_percentage(proposal)).to eq 50
end
it "should be 100 if there are more votes than needed" do
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2)
expect(progress_bar_percentage(proposal)).to eq 100
@@ -39,6 +44,11 @@ describe ProposalsHelper do
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2)
expect(supports_percentage(proposal)).to eq "100%"
end
it "should take into account the physical votes" do
proposal = create(:proposal, physical_votes: Proposal.votes_needed_for_success/2)
expect(supports_percentage(proposal)).to eq "50%"
end
end
end