Skip to content

Commit

Permalink
continue fix test file
Browse files Browse the repository at this point in the history
  • Loading branch information
BarbaraOliveira13 committed Nov 18, 2024
1 parent a14ab34 commit 814a001
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions spec/models/decidim/decidim_awesome/proposal_extra_field_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ module Decidim::DecidimAwesome
let(:proposal) { create(:extended_proposal) }
let(:component) { create(:component, settings: { awesome_voting_manifest: "default" }) }

it { is_expected.to be_valid }

before do
create(:proposal_vote, proposal: proposal, weight: 1)
create(:proposal_vote, proposal: proposal, weight: 2)
puts "Extra Fields Before Save: #{proposal.extra_fields.inspect}"
# create(:proposal_vote, proposal: proposal, weight: 1)
# create(:proposal_vote, proposal: proposal, weight: 2)
puts "Extra Fields Before Save: #{proposal.extra_fields.inspect}"
end

it { is_expected.to be_valid }

it "has a proposal associated" do
expect(extra_fields.proposal).to be_a(Decidim::Proposals::Proposal)
end
Expand Down Expand Up @@ -219,7 +221,12 @@ module Decidim::DecidimAwesome
end

it "returns all vote weights for a component" do
allow(component.settings).to receive(:awesome_voting_manifest).and_return("default")
expect(proposal.reload.extra_fields.vote_weight_totals).to eq({ "3" => 1, "4" => 1 })
# update_vote_weights!
proposal.update_vote_weights!
# puts "Vote Weights After Update: #{proposal.vote_weights}"
# puts "Vote Weight Totals: #{proposal.extra_fields.vote_weight_totals}"
expect(proposal.vote_weights).to eq({ "1" => 0, "2" => 0 })
proposal.update_vote_weights!
expect(proposal.vote_weights).to eq({ "1" => 1, "2" => 0 })
Expand Down

0 comments on commit 814a001

Please sign in to comment.