Files
nairobi/spec/helpers/votes_helper_spec.rb
Javi Martín b98244afd9 Remove votes query optimizations
Just like we did in commit 0214184b2d for 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 commit 0214184b2, so we're removing it now that
we're removing the `voted_for?` helper method.
2022-02-21 18:47:13 +01:00

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