Skip to content

Commit

Permalink
Fix cell spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Vergés authored and Ivan Vergés committed Dec 2, 2024
1 parent 93b0e45 commit f66fabc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def metadata_cell
end

def cache_hash
@cache_hash ||= "#{decidim_original_cache_hash}#{Decidim.cache_key_separator}#{model.extra_fields&.reload&.vote_weight_totals}"
@cache_hash ||= "#{decidim_original_cache_hash}#{Decidim.cache_key_separator}#{model.extra_fields&.vote_weight_totals}"
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions spec/cells/proposal_l_cell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ module Proposals
let!(:component) { create(:proposal_component, :with_votes_enabled, organization:, settings: { awesome_voting_manifest: manifest }) }
let!(:extra_fields) { create(:awesome_proposal_extra_fields, proposal:) }
let(:proposal) { create(:proposal, component:) }
let(:request) { double(host: "example.org", env: {}) }

before do
allow(subject).to receive(:request).and_return(request)
Decidim::DecidimAwesome.voting_registry.register(:another_voting_system) do |voting|
voting.show_vote_button_view = ""
voting.show_votes_count_view = ""
Expand Down Expand Up @@ -41,6 +43,7 @@ module Proposals
extra_fields.update_column(:vote_weight_totals, 100)
# rubocop:enable Rails/SkipsModelValidations
proposal.reload
subject.instance_variable_set(:@cache_hash, nil)
expect(cache1).not_to eq(subject.send(:cache_hash))
end
end
Expand Down

0 comments on commit f66fabc

Please sign in to comment.