diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 03:07:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 03:07:49 +0300 |
commit | 77237c5a6b9044f58beabc54d3589e5fa09cbfba (patch) | |
tree | f43188047fe8955f6cf78e05ae9c2e8f6a019e0b /spec/lib/gitlab/repository_set_cache_spec.rb | |
parent | 2fd92f2dc784ade9cb4e1c33dd60cbfad7b86818 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/repository_set_cache_spec.rb')
-rw-r--r-- | spec/lib/gitlab/repository_set_cache_spec.rb | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/spec/lib/gitlab/repository_set_cache_spec.rb b/spec/lib/gitlab/repository_set_cache_spec.rb index de0f3602346..bcf27b338f6 100644 --- a/spec/lib/gitlab/repository_set_cache_spec.rb +++ b/spec/lib/gitlab/repository_set_cache_spec.rb @@ -11,16 +11,41 @@ describe Gitlab::RepositorySetCache, :clean_gitlab_redis_cache do describe '#cache_key' do subject { cache.cache_key(:foo) } - it 'includes the namespace' do - is_expected.to eq("foo:#{namespace}:set") + shared_examples 'cache_key examples' do + it 'includes the namespace' do + is_expected.to eq("foo:#{namespace}:set") + end + + context 'with a given namespace' do + let(:extra_namespace) { 'my:data' } + let(:cache) { described_class.new(repository, extra_namespace: extra_namespace) } + + it 'includes the full namespace' do + is_expected.to eq("foo:#{namespace}:#{extra_namespace}:set") + end + end + end + + describe 'project repository' do + it_behaves_like 'cache_key examples' do + let(:repository) { project.repository } + end + end + + describe 'personal snippet repository' do + let_it_be(:personal_snippet) { create(:personal_snippet) } + let(:namespace) { repository.full_path } + + it_behaves_like 'cache_key examples' do + let(:repository) { personal_snippet.repository } + end end - context 'with a given namespace' do - let(:extra_namespace) { 'my:data' } - let(:cache) { described_class.new(repository, extra_namespace: extra_namespace) } + describe 'project snippet repository' do + let_it_be(:project_snippet) { create(:project_snippet, project: project) } - it 'includes the full namespace' do - is_expected.to eq("foo:#{namespace}:#{extra_namespace}:set") + it_behaves_like 'cache_key examples' do + let(:repository) { project_snippet.repository } end end end |