Skip to content
代码片段 群组 项目
提交 4f8c7331 编辑于 作者: Frédéric Caplette's avatar Frédéric Caplette
浏览文件

Merge branch '417136-investigate-slowdown-of-pwacontroller-manifest' into 'master'

No related branches found
No related tags found
无相关合并请求
<%- cache current_appearance do %>
{ {
"name": "<%= appearance_pwa_name %>", "name": "<%= appearance_pwa_name %>",
"short_name": "<%= appearance_pwa_short_name %>", "short_name": "<%= appearance_pwa_short_name %>",
...@@ -33,3 +34,4 @@ ...@@ -33,3 +34,4 @@
} }
<% end -%>] <% end -%>]
} }
<% end %>
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'pwa/manifest', feature_category: :navigation do
describe 'view caching', :use_clean_rails_memory_store_fragment_caching do
let(:appearance) { build_stubbed(:appearance, pwa_name: 'My GitLab') }
context 'when appearance is unchanged' do
it 'reuses the cached view' do
allow(view).to receive(:current_appearance).and_return(appearance)
allow(view).to receive(:appearance_pwa_name).and_call_original
render
render
expect(view).to have_received(:appearance_pwa_name).once
end
end
context 'when appearance has changed' do
let(:changed_appearance) { build_stubbed(:appearance, pwa_name: 'My new GitLab') }
it 'does not use the cached view' do
allow(view).to receive(:current_appearance).and_return(appearance)
allow(view).to receive(:appearance_pwa_name).and_call_original
render
allow(view).to receive(:current_appearance).and_return(changed_appearance)
render
expect(view).to have_received(:appearance_pwa_name).twice
expect(rendered).to have_content 'My new GitLab'
end
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册