Just like we did in commit0214184b2dfor investments, we're removing some possible optimizations (we don't have any benchmarks proving they affect performance at all) in order to simplify the code. The investement votes component `delegate` code was accidentally left but isn't used since commit0214184b2, so we're removing it now that we're removing the `voted_for?` helper method.
15 lines
412 B
Ruby
15 lines
412 B
Ruby
require "rails_helper"
|
|
|
|
describe VotesHelper do
|
|
describe "#votes_percentage" do
|
|
it "alwayses sum 100%" do
|
|
debate = create(:debate)
|
|
create_list(:vote, 8, votable: debate, vote_flag: true)
|
|
create_list(:vote, 3, votable: debate, vote_flag: false)
|
|
|
|
expect(votes_percentage("likes", debate)).to eq("72%")
|
|
expect(votes_percentage("dislikes", debate)).to eq("28%")
|
|
end
|
|
end
|
|
end
|