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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
3962d33f
Commit
3962d33f
authored
May 13, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge cross-reference refactoring with EE code
parent
b2d45bb5
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
541 deletions
+65
-541
app/services/system_note_service.rb
app/services/system_note_service.rb
+1
-3
spec/models/note_spec.rb
spec/models/note_spec.rb
+0
-538
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+64
-0
No files found.
app/services/system_note_service.rb
View file @
3962d33f
...
@@ -167,10 +167,8 @@ class SystemNoteService
...
@@ -167,10 +167,8 @@ class SystemNoteService
if
noteable
.
is_a?
(
ExternalIssue
)
if
noteable
.
is_a?
(
ExternalIssue
)
noteable
.
project
.
issues_tracker
.
create_cross_reference_note
(
noteable
,
mentioner
,
author
)
noteable
.
project
.
issues_tracker
.
create_cross_reference_note
(
noteable
,
mentioner
,
author
)
else
else
create
(
note_options
)
create
_note
(
note_options
)
end
end
create_note
(
note_options
)
end
end
def
self
.
cross_reference?
(
note_text
)
def
self
.
cross_reference?
(
note_text
)
...
...
spec/models/note_spec.rb
View file @
3962d33f
This diff is collapsed.
Click to expand it.
spec/services/system_note_service_spec.rb
View file @
3962d33f
...
@@ -343,4 +343,68 @@ describe SystemNoteService do
...
@@ -343,4 +343,68 @@ describe SystemNoteService do
end
end
end
end
end
end
include
JiraServiceHelper
describe
'JIRA integration'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:mergereq
)
{
create
(
:merge_request
,
:simple
,
target_project:
project
,
source_project:
project
)
}
let
(
:jira_issue
)
{
JiraIssue
.
new
(
"JIRA-1"
,
project
)}
let
(
:jira_tracker
)
{
project
.
create_jira_service
if
project
.
jira_service
.
nil?
}
let
(
:commit
)
{
project
.
commit
}
context
'in JIRA issue tracker'
do
before
do
jira_service_settings
WebMock
.
stub_request
(
:post
,
jira_api_comment_url
)
end
after
do
jira_tracker
.
destroy!
end
describe
"new reference"
do
before
do
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
:body
=>
jira_issue_comments
)
end
subject
{
Note
.
create_cross_reference_note
(
jira_issue
,
commit
,
author
)
}
it
{
is_expected
.
to
eq
(
jira_status_message
)
}
end
describe
"existing reference"
do
before
do
message
=
"[
#{
author
.
name
}
|http://localhost/u/
#{
author
.
username
}
] mentioned this issue in [a commit of
#{
project
.
path_with_namespace
}
|http://localhost/
#{
project
.
path_with_namespace
}
/commit/
#{
commit
.
id
}
]."
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
:body
=>
"{
\"
comments
\"
:[{
\"
body
\"
:
\"
#{
message
}
\"
}]}"
)
end
subject
{
Note
.
create_cross_reference_note
(
jira_issue
,
commit
,
author
)
}
it
{
is_expected
.
not_to
eq
(
jira_status_message
)
}
end
end
context
'issue from an issue'
do
context
'in JIRA issue tracker'
do
before
do
jira_service_settings
WebMock
.
stub_request
(
:post
,
jira_api_comment_url
)
WebMock
.
stub_request
(
:get
,
jira_api_comment_url
).
to_return
(
:body
=>
jira_issue_comments
)
end
after
do
jira_tracker
.
destroy!
end
subject
{
Note
.
create_cross_reference_note
(
jira_issue
,
issue
,
author
)
}
it
{
is_expected
.
to
eq
(
jira_status_message
)
}
end
end
end
end
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