Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
685072f5
Commit
685072f5
authored
Nov 05, 2016
by
Jarka Kadlecova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify url generation
parent
9a1ded1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+8
-10
changelogs/unreleased/jira_service_simplify.yml
changelogs/unreleased/jira_service_simplify.yml
+4
-0
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+5
-2
No files found.
app/models/project_services/jira_service.rb
View file @
685072f5
...
...
@@ -256,16 +256,14 @@ class JiraService < IssueTrackerService
end
def
build_entity_url
(
entity_name
,
entity_id
)
resource_url
(
polymorphic_url
(
[
self
.
project
.
namespace
.
becomes
(
Namespace
),
self
.
project
,
entity_name
],
id:
entity_id
,
routing_type: :path
)
polymorphic_url
(
[
self
.
project
.
namespace
.
becomes
(
Namespace
),
self
.
project
,
entity_name
],
id:
entity_id
,
host:
Settings
.
gitlab
.
base_url
)
end
end
changelogs/unreleased/jira_service_simplify.yml
0 → 100644
View file @
685072f5
---
title
:
simplify url generation
merge_request
:
author
:
Jarka Kadlecova
spec/models/project_services/jira_service_spec.rb
View file @
685072f5
...
...
@@ -69,6 +69,7 @@ describe JiraService, models: true do
end
describe
"Execute"
do
let
(
:custom_base_url
)
{
'http://custom_url'
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
...
...
@@ -107,10 +108,12 @@ describe JiraService, models: true do
end
it
"references the GitLab commit/merge request"
do
@jira_service
.
execute
(
merge_request
,
ExternalIssue
.
new
(
"JIRA-123"
,
project
))
stub_config_setting
(
base_url:
custom_base_url
)
stub_config_setting
(
url:
custom_base_url
)
@jira_service
.
execute
(
merge_request
,
ExternalIssue
.
new
(
"JIRA-123"
,
project
))
expect
(
WebMock
).
to
have_requested
(
:post
,
@comment_url
).
with
(
body:
/
#{
Gitlab
.
config
.
gitlab
.
url
}
\/
#{
project
.
path_with_namespace
}
\/commit\/
#{
merge_request
.
diff_head_sha
}
/
body:
/
#{
custom_base_
url
}
\/
#{
project
.
path_with_namespace
}
\/commit\/
#{
merge_request
.
diff_head_sha
}
/
).
once
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment