diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/gl_repository | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/gl_repository')
-rw-r--r-- | spec/lib/gitlab/gl_repository/repo_type_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gl_repository/repo_type_spec.rb b/spec/lib/gitlab/gl_repository/repo_type_spec.rb index 6185b068d4c..bf6df55b71e 100644 --- a/spec/lib/gitlab/gl_repository/repo_type_spec.rb +++ b/spec/lib/gitlab/gl_repository/repo_type_spec.rb @@ -7,6 +7,7 @@ describe Gitlab::GlRepository::RepoType do let_it_be(:project_snippet) { create(:project_snippet, project: project, author: project.owner) } let(:project_path) { project.repository.full_path } let(:wiki_path) { project.wiki.repository.full_path } + let(:design_path) { project.design_repository.full_path } let(:personal_snippet_path) { "snippets/#{personal_snippet.id}" } let(:project_snippet_path) { "#{project.full_path}/snippets/#{project_snippet.id}" } @@ -24,6 +25,7 @@ describe Gitlab::GlRepository::RepoType do expect(described_class).not_to be_wiki expect(described_class).to be_project expect(described_class).not_to be_snippet + expect(described_class).not_to be_design end end @@ -33,6 +35,7 @@ describe Gitlab::GlRepository::RepoType do expect(described_class.valid?(wiki_path)).to be_truthy expect(described_class.valid?(personal_snippet_path)).to be_truthy expect(described_class.valid?(project_snippet_path)).to be_truthy + expect(described_class.valid?(design_path)).to be_truthy end end end @@ -51,6 +54,7 @@ describe Gitlab::GlRepository::RepoType do expect(described_class).to be_wiki expect(described_class).not_to be_project expect(described_class).not_to be_snippet + expect(described_class).not_to be_design end end @@ -60,6 +64,7 @@ describe Gitlab::GlRepository::RepoType do expect(described_class.valid?(wiki_path)).to be_truthy expect(described_class.valid?(personal_snippet_path)).to be_falsey expect(described_class.valid?(project_snippet_path)).to be_falsey + expect(described_class.valid?(design_path)).to be_falsey end end end @@ -79,6 +84,7 @@ describe Gitlab::GlRepository::RepoType do expect(described_class).to be_snippet expect(described_class).not_to be_wiki expect(described_class).not_to be_project + expect(described_class).not_to be_design end end @@ -88,6 +94,7 @@ describe Gitlab::GlRepository::RepoType do expect(described_class.valid?(wiki_path)).to be_falsey expect(described_class.valid?(personal_snippet_path)).to be_truthy expect(described_class.valid?(project_snippet_path)).to be_truthy + expect(described_class.valid?(design_path)).to be_falsey end end end @@ -115,8 +122,38 @@ describe Gitlab::GlRepository::RepoType do expect(described_class.valid?(wiki_path)).to be_falsey expect(described_class.valid?(personal_snippet_path)).to be_truthy expect(described_class.valid?(project_snippet_path)).to be_truthy + expect(described_class.valid?(design_path)).to be_falsey end end end end + + describe Gitlab::GlRepository::DESIGN do + it_behaves_like 'a repo type' do + let(:expected_identifier) { "design-#{project.id}" } + let(:expected_id) { project.id.to_s } + let(:expected_suffix) { '.design' } + let(:expected_repository) { project.design_repository } + let(:expected_container) { project } + end + + it 'knows its type' do + aggregate_failures do + expect(described_class).to be_design + expect(described_class).not_to be_project + expect(described_class).not_to be_wiki + expect(described_class).not_to be_snippet + end + end + + it 'checks if repository path is valid' do + aggregate_failures do + expect(described_class.valid?(design_path)).to be_truthy + expect(described_class.valid?(project_path)).to be_falsey + expect(described_class.valid?(wiki_path)).to be_falsey + expect(described_class.valid?(personal_snippet_path)).to be_falsey + expect(described_class.valid?(project_snippet_path)).to be_falsey + end + end + end end |