diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-01 00:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-01 00:09:45 +0300 |
commit | 5376a0c41d6264e6cc820b5d12220ae4ff79f2ae (patch) | |
tree | fafcbd553b1ea605104633808cc5ad8455de1f16 /spec/views | |
parent | 6c3503cc3bd943f6b5681283da2729d04ce4066e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/pwa/manifest.json.erb_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/views/pwa/manifest.json.erb_spec.rb b/spec/views/pwa/manifest.json.erb_spec.rb new file mode 100644 index 00000000000..a5075bfe6fe --- /dev/null +++ b/spec/views/pwa/manifest.json.erb_spec.rb @@ -0,0 +1,36 @@ +# 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 |