diff options
author | Stan Hu <stanhu@gmail.com> | 2018-01-27 03:06:01 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-01-30 03:49:43 +0300 |
commit | 8f965d0fa39b5800b0bb135791a6817a41007d56 (patch) | |
tree | 4eebf2b20547df741d90b7a7156df38d21727a9e /spec/models/project_services | |
parent | 1f309b69df3f71d988d4d31b08a1b683099a46e5 (diff) |
Fix JIRA not working when a trailing slash is included
Leaving a trailing slash in the context option causes the jira-ruby
gem to add an extra slash in HTTP requests to the URL, preventing
JIRA from working properly.
Closes #42494
Diffstat (limited to 'spec/models/project_services')
-rw-r--r-- | spec/models/project_services/jira_service_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index c9b3c6cf602..1eaaadf56c5 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -3,6 +3,29 @@ require 'spec_helper' describe JiraService do include Gitlab::Routing + describe '#options' do + let(:service) do + described_class.new( + project: build_stubbed(:project), + active: true, + username: 'username', + password: 'test', + jira_issue_transition_id: 24, + url: 'http://jira.test.com/path/' + ) + end + + it 'sets the URL properly' do + # jira-ruby gem parses the URI and handles trailing slashes + # fine: https://github.com/sumoheavy/jira-ruby/blob/v1.4.1/lib/jira/http_client.rb#L59 + expect(service.options[:site]).to eq('http://jira.test.com/') + end + + it 'leaves out trailing slashes in context' do + expect(service.options[:context_path]).to eq('/path') + end + end + describe "Associations" do it { is_expected.to belong_to :project } it { is_expected.to have_one :service_hook } |