diff options
Diffstat (limited to 'spec/lib/gitlab/gl_repository/repo_type_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gl_repository/repo_type_spec.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/spec/lib/gitlab/gl_repository/repo_type_spec.rb b/spec/lib/gitlab/gl_repository/repo_type_spec.rb index 9e09e1411ab..8bbcc644f6d 100644 --- a/spec/lib/gitlab/gl_repository/repo_type_spec.rb +++ b/spec/lib/gitlab/gl_repository/repo_type_spec.rb @@ -2,33 +2,45 @@ require 'spec_helper' describe Gitlab::GlRepository::RepoType do - set(:project) { create(:project) } + let_it_be(:project) { create(:project) } describe Gitlab::GlRepository::PROJECT do it_behaves_like 'a repo type' do let(:expected_identifier) { "project-#{project.id}" } let(:expected_id) { project.id.to_s } - let(:expected_suffix) { "" } + let(:expected_suffix) { '' } let(:expected_repository) { project.repository } + let(:expected_container) { project } end - it "knows its type" do + it 'knows its type' do expect(described_class).not_to be_wiki expect(described_class).to be_project end + + it 'checks if repository path is valid' do + expect(described_class.valid?(project.repository.full_path)).to be_truthy + expect(described_class.valid?(project.wiki.repository.full_path)).to be_truthy + end end describe Gitlab::GlRepository::WIKI do it_behaves_like 'a repo type' do let(:expected_identifier) { "wiki-#{project.id}" } let(:expected_id) { project.id.to_s } - let(:expected_suffix) { ".wiki" } + let(:expected_suffix) { '.wiki' } let(:expected_repository) { project.wiki.repository } + let(:expected_container) { project } end - it "knows its type" do + it 'knows its type' do expect(described_class).to be_wiki expect(described_class).not_to be_project end + + it 'checks if repository path is valid' do + expect(described_class.valid?(project.repository.full_path)).to be_falsey + expect(described_class.valid?(project.wiki.repository.full_path)).to be_truthy + end end end |