Skip to content
Snippets Groups Projects
Commit ea9dd29a authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Reset @full_path to nil when cache expires

parent 7fe97d94
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment