diff --git a/app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb b/app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb index 3dfcd5291..7d85bd460 100644 --- a/app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb +++ b/app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb @@ -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 diff --git a/spec/cells/proposal_l_cell_spec.rb b/spec/cells/proposal_l_cell_spec.rb index d827e161f..5099b8cd3 100644 --- a/spec/cells/proposal_l_cell_spec.rb +++ b/spec/cells/proposal_l_cell_spec.rb @@ -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 = "" @@ -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