diff options
Diffstat (limited to 'spec/lib/gitlab/pages/cache_control_spec.rb')
-rw-r--r-- | spec/lib/gitlab/pages/cache_control_spec.rb | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/spec/lib/gitlab/pages/cache_control_spec.rb b/spec/lib/gitlab/pages/cache_control_spec.rb index 431c989e874..d46124e0e16 100644 --- a/spec/lib/gitlab/pages/cache_control_spec.rb +++ b/spec/lib/gitlab/pages/cache_control_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Pages::CacheControl do +RSpec.describe Gitlab::Pages::CacheControl, feature_category: :pages do describe '.for_namespace' do subject(:cache_control) { described_class.for_namespace(1) } @@ -11,8 +11,14 @@ RSpec.describe Gitlab::Pages::CacheControl do describe '#clear_cache' do it 'clears the cache' do expect(Rails.cache) - .to receive(:delete) - .with(/pages_domain_for_namespace_1_*/) + .to receive(:delete_multi) + .with( + array_including( + [ + "pages_domain_for_namespace_1", + /pages_domain_for_namespace_1_*/ + ] + )) subject.clear_cache end @@ -27,8 +33,14 @@ RSpec.describe Gitlab::Pages::CacheControl do describe '#clear_cache' do it 'clears the cache' do expect(Rails.cache) - .to receive(:delete) - .with(/pages_domain_for_project_1_*/) + .to receive(:delete_multi) + .with( + array_including( + [ + "pages_domain_for_project_1", + /pages_domain_for_project_1_*/ + ] + )) subject.clear_cache end @@ -58,6 +70,14 @@ RSpec.describe Gitlab::Pages::CacheControl do expect(described_class.new(type: :project, id: 1).cache_key).not_to eq(cache_key) end + + it 'caches the application settings hash' do + expect(Rails.cache) + .to receive(:write) + .with("pages_domain_for_project_1", kind_of(Set)) + + described_class.new(type: :project, id: 1).cache_key + end end it 'fails with invalid type' do |