Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 00:08:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 00:08:08 +0300
commite0b84f4ba4b44c8ecf00be97843c40df2550b74c (patch)
tree7cecae4276358dd46d7fa15f84068f7b4c626089 /spec/models/project_services
parent73391dcc368ef846c2960c1d0ef5e64ca78e1bee (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/project_services')
-rw-r--r--spec/models/project_services/external_wiki_service_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/models/project_services/external_wiki_service_spec.rb b/spec/models/project_services/external_wiki_service_spec.rb
index bdd8605436f..f8d88a944a5 100644
--- a/spec/models/project_services/external_wiki_service_spec.rb
+++ b/spec/models/project_services/external_wiki_service_spec.rb
@@ -26,4 +26,34 @@ describe ExternalWikiService do
it { is_expected.not_to validate_presence_of(:external_wiki_url) }
end
end
+
+ describe 'test' do
+ before do
+ subject.properties['external_wiki_url'] = url
+ end
+
+ let(:url) { 'http://foo' }
+ let(:data) { nil }
+ let(:result) { subject.test(data) }
+
+ context 'the URL is not reachable' do
+ before do
+ WebMock.stub_request(:get, url).to_return(status: 404, body: 'not a page')
+ end
+
+ it 'is not successful' do
+ expect(result[:success]).to be_falsey
+ end
+ end
+
+ context 'the URL is reachable' do
+ before do
+ WebMock.stub_request(:get, url).to_return(status: 200, body: 'foo')
+ end
+
+ it 'is successful' do
+ expect(result[:success]).to be_truthy
+ end
+ end
+ end
end