diff options
Diffstat (limited to 'spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb new file mode 100644 index 00000000000..f4960b9f134 --- /dev/null +++ b/spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'a repo type' do + describe "#identifier_for_repositorable" do + subject { described_class.identifier_for_repositorable(project) } + + it { is_expected.to eq(expected_identifier) } + end + + describe "#fetch_id" do + it "finds an id match in the identifier" do + expect(described_class.fetch_id(expected_identifier)).to eq(expected_id) + end + + it 'does not break on other identifiers' do + expect(described_class.fetch_id("wiki-noid")).to eq(nil) + end + end + + describe "#path_suffix" do + subject { described_class.path_suffix } + + it { is_expected.to eq(expected_suffix) } + end + + describe "#repository_for" do + it "finds the repository for the repo type" do + expect(described_class.repository_for(project)).to eq(expected_repository) + end + end +end |