Commit 48b976e0 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-issue-tracker-spec' into 'master'

Prevent GitLab issue tracker spec from failing later specs

Closes #35042

See merge request !12835
parents a97208dd 5db15654
...@@ -23,38 +23,29 @@ describe GitlabIssueTrackerService, models: true do ...@@ -23,38 +23,29 @@ describe GitlabIssueTrackerService, models: true do
describe 'project and issue urls' do describe 'project and issue urls' do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:service) { project.create_gitlab_issue_tracker_service(active: true) }
context 'with absolute urls' do context 'with absolute urls' do
before do before do
GitlabIssueTrackerService.default_url_options[:script_name] = "/gitlab/root" allow(GitlabIssueTrackerService).to receive(:default_url_options).and_return(script_name: "/gitlab/root")
@service = project.create_gitlab_issue_tracker_service(active: true)
end
after do
@service.destroy!
end end
it 'gives the correct path' do it 'gives the correct path' do
expect(@service.project_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.path_with_namespace}/issues") expect(service.project_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.path_with_namespace}/issues")
expect(@service.new_issue_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.path_with_namespace}/issues/new") expect(service.new_issue_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.path_with_namespace}/issues/new")
expect(@service.issue_url(432)).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.path_with_namespace}/issues/432") expect(service.issue_url(432)).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.path_with_namespace}/issues/432")
end end
end end
context 'with relative urls' do context 'with relative urls' do
before do before do
GitlabIssueTrackerService.default_url_options[:script_name] = "/gitlab/root" allow(GitlabIssueTrackerService).to receive(:default_url_options).and_return(script_name: "/gitlab/root")
@service = project.create_gitlab_issue_tracker_service(active: true)
end
after do
@service.destroy!
end end
it 'gives the correct path' do it 'gives the correct path' do
expect(@service.project_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues") expect(service.project_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues")
expect(@service.new_issue_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues/new") expect(service.new_issue_path).to eq("/gitlab/root/#{project.path_with_namespace}/issues/new")
expect(@service.issue_path(432)).to eq("/gitlab/root/#{project.path_with_namespace}/issues/432") expect(service.issue_path(432)).to eq("/gitlab/root/#{project.path_with_namespace}/issues/432")
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment