2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ::Gitlab::GlRepository do
|
|
|
|
describe '.parse' do
|
2017-09-10 17:25:29 +05:30
|
|
|
set(:project) { create(:project, :repository) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
it 'parses a project gl_repository' do
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(described_class.parse("project-#{project.id}")).to eq([project, Gitlab::GlRepository::PROJECT])
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'parses a wiki gl_repository' do
|
2019-07-07 11:18:12 +05:30
|
|
|
expect(described_class.parse("wiki-#{project.id}")).to eq([project, Gitlab::GlRepository::WIKI])
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'throws an argument error on an invalid gl_repository' do
|
|
|
|
expect { described_class.parse("badformat-#{project.id}") }.to raise_error(ArgumentError)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|