summaryrefslogtreecommitdiff
path: root/spec/models/project_wiki_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/project_wiki_spec.rb')
-rw-r--r--spec/models/project_wiki_spec.rb24
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb
index d12dd97bb9e..31d1d1fd7d1 100644
--- a/spec/models/project_wiki_spec.rb
+++ b/spec/models/project_wiki_spec.rb
@@ -47,11 +47,25 @@ describe ProjectWiki do
describe "#http_url_to_repo" do
let(:project) { create :project }
- it 'returns the full http url to the repo' do
- expected_url = "#{Gitlab.config.gitlab.url}/#{subject.full_path}.git"
+ context 'when a custom HTTP clone URL root is not set' do
+ it 'returns the full http url to the repo' do
+ expected_url = "#{Gitlab.config.gitlab.url}/#{subject.full_path}.git"
- expect(project_wiki.http_url_to_repo).to eq(expected_url)
- expect(project_wiki.http_url_to_repo).not_to include('@')
+ expect(project_wiki.http_url_to_repo).to eq(expected_url)
+ expect(project_wiki.http_url_to_repo).not_to include('@')
+ end
+ end
+
+ context 'when a custom HTTP clone URL root is set' do
+ before do
+ stub_application_setting(custom_http_clone_url_root: 'https://git.example.com:51234')
+ end
+
+ it 'returns the full http url to the repo, with the root replaced with the custom one' do
+ expected_url = "https://git.example.com:51234/#{subject.full_path}.git"
+
+ expect(project_wiki.http_url_to_repo).to eq(expected_url)
+ end
end
end
@@ -95,6 +109,7 @@ describe ProjectWiki do
context "when the wiki repository is empty" do
describe '#empty?' do
subject { super().empty? }
+
it { is_expected.to be_truthy }
end
end
@@ -107,6 +122,7 @@ describe ProjectWiki do
describe '#empty?' do
subject { super().empty? }
+
it { is_expected.to be_falsey }
it 'only instantiates a Wiki page once' do