summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 18:09:37 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 18:09:37 +0000
commit495c22d1245b6212b21b7379a542df73dfa77206 (patch)
tree5f0f82dd6c8c4fe1c4bd411f9e398b1a6eaaa69f /spec/support/shared_examples
parentf3b1e07903a7f509b11ad7cf188fac46d98f77f6 (diff)
downloadgitlab-ce-495c22d1245b6212b21b7379a542df73dfa77206.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r--spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb70
1 files changed, 17 insertions, 53 deletions
diff --git a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
index 368ec0694fd..41de499f590 100644
--- a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
@@ -1,6 +1,11 @@
# frozen_string_literal: true
RSpec.shared_examples 'model with repository' do
+ let(:container) { raise NotImplementedError }
+ let(:stubbed_container) { raise NotImplementedError }
+ let(:expected_full_path) { raise NotImplementedError }
+ let(:expected_web_url_path) { expected_full_path }
+
describe '#commits_by' do
let(:commits) { container.repository.commits('HEAD', limit: 3).commits }
let(:commit_shas) { commits.map(&:id) }
@@ -46,74 +51,33 @@ RSpec.shared_examples 'model with repository' do
end
end
- describe '#ssh_url_to_repo' do
- it 'returns container ssh address' do
- expect(container.ssh_url_to_repo).to eq container.url_to_repo
+ describe '#url_to_repo' do
+ it 'returns the SSH URL to the repository' do
+ expect(container.url_to_repo).to eq("#{Gitlab.config.gitlab_shell.ssh_path_prefix}#{expected_web_url_path}.git")
end
end
- describe '#http_url_to_repo' do
- subject { container.http_url_to_repo }
-
- context 'when a custom HTTP clone URL root is not set' do
- it 'returns the url to the repo without a username' do
- expect(subject).to eq("#{container.web_url}.git")
- expect(subject).not_to include('@')
- end
+ describe '#ssh_url_to_repo' do
+ it 'returns the SSH URL to the repository' do
+ expect(container.ssh_url_to_repo).to eq(container.url_to_repo)
end
+ end
- context 'when a custom HTTP clone URL root is set' do
- before do
- stub_application_setting(custom_http_clone_url_root: custom_http_clone_url_root)
- end
-
- context 'when custom HTTP clone URL root has a relative URL root' do
- context 'when custom HTTP clone URL root ends with a slash' do
- let(:custom_http_clone_url_root) { 'https://git.example.com:51234/mygitlab/' }
-
- it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(subject).to eq("#{custom_http_clone_url_root}#{expected_web_url_path}.git")
- end
- end
-
- context 'when custom HTTP clone URL root does not end with a slash' do
- let(:custom_http_clone_url_root) { 'https://git.example.com:51234/mygitlab' }
-
- it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(subject).to eq("#{custom_http_clone_url_root}/#{expected_web_url_path}.git")
- end
- end
- end
-
- context 'when custom HTTP clone URL root does not have a relative URL root' do
- context 'when custom HTTP clone URL root ends with a slash' do
- let(:custom_http_clone_url_root) { 'https://git.example.com:51234/' }
-
- it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(subject).to eq("#{custom_http_clone_url_root}#{expected_web_url_path}.git")
- end
- end
-
- context 'when custom HTTP clone URL root does not end with a slash' do
- let(:custom_http_clone_url_root) { 'https://git.example.com:51234' }
-
- it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(subject).to eq("#{custom_http_clone_url_root}/#{expected_web_url_path}.git")
- end
- end
- end
+ describe '#http_url_to_repo' do
+ it 'returns the HTTP URL to the repository' do
+ expect(container.http_url_to_repo).to eq("#{Gitlab.config.gitlab.url}/#{expected_web_url_path}.git")
end
end
describe '#repository' do
it 'returns valid repo' do
- expect(container.repository).to be_kind_of(expected_repository_klass)
+ expect(container.repository).to be_kind_of(Repository)
end
end
describe '#storage' do
it 'returns valid storage' do
- expect(container.storage).to be_kind_of(expected_storage_klass)
+ expect(container.storage).to be_kind_of(Storage::Hashed)
end
end