diff --git a/app/models/concerns/routable.rb b/app/models/concerns/routable.rb index 2305e01d3f1bcc2074d4b251534f2bcfa094859f..ee108f010a69052cee07c6fd41cf81ac48caffbb 100644 --- a/app/models/concerns/routable.rb +++ b/app/models/concerns/routable.rb @@ -108,6 +108,7 @@ module Routable def expires_full_path_cache RequestStore.delete(full_path_key) if RequestStore.active? + @full_path = nil end def build_full_path diff --git a/spec/models/concerns/routable_spec.rb b/spec/models/concerns/routable_spec.rb index be82a601b36de4607cbf5c72fb0f20fd2ea66243..36aedd2f70142c156611f8c1b0c2297876f52bd2 100644 --- a/spec/models/concerns/routable_spec.rb +++ b/spec/models/concerns/routable_spec.rb @@ -135,11 +135,12 @@ describe Group, 'Routable' do describe '#expires_full_path_cache' do context 'with RequestStore active', :request_store do it 'expires the full_path cache' do - expect(group).to receive(:uncached_full_path).twice.and_call_original + expect(group.full_path).to eq('foo') - 3.times { group.full_path } + group.route.update(path: 'bar', name: 'bar') group.expires_full_path_cache - 3.times { group.full_path } + + expect(group.full_path).to eq('bar') end end end