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
eb014dd5
Commit
eb014dd5
authored
Oct 16, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix JIRA mention spec
parent
2d7be2d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
29 deletions
+33
-29
Gemfile.lock
Gemfile.lock
+0
-3
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-1
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+32
-25
No files found.
Gemfile.lock
View file @
eb014dd5
...
...
@@ -933,6 +933,3 @@ DEPENDENCIES
virtus (~> 1.0.1)
webmock (~> 1.21.0)
wikicloth (= 0.8.1)
BUNDLED WITH
1.10.6
app/services/git_push_service.rb
View file @
eb014dd5
...
...
@@ -96,7 +96,7 @@ class GitPushService
Issues
::
CloseService
.
new
(
project
,
authors
[
commit
],
{}).
execute
(
issue
,
commit
)
end
end
commit
.
create_cross_references!
(
authors
[
commit
],
closed_issues
)
end
end
...
...
spec/services/git_push_service_spec.rb
View file @
eb014dd5
...
...
@@ -274,7 +274,7 @@ describe GitPushService do
allow
(
closing_commit
).
to
receive_messages
({
issue_closing_regex:
Regexp
.
new
(
Gitlab
.
config
.
gitlab
.
issue_closing_pattern
),
safe_message:
"this is some work.
\n\n
closes JIRA-1"
,
safe_message:
message
,
author_name:
commit_author
.
name
,
author_email:
commit_author
.
email
})
...
...
@@ -286,33 +286,40 @@ describe GitPushService do
jira_tracker
.
destroy!
end
it
"should initiate one api call to jira server to close the issue"
do
message
=
{
update:
{
comment:
[{
add:
{
body:
"Issue solved with [
#{
closing_commit
.
id
}
|http://localhost/
#{
project
.
path_with_namespace
}
/commit/
#{
closing_commit
.
id
}
]."
}
}]
},
transition:
{
id:
'2'
}
}.
to_json
context
"mentioning an issue"
do
let
(
:message
)
{
"this is some work.
\n\n
related to JIRA-1"
}
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
expect
(
WebMock
).
to
have_requested
(
:post
,
jira_api_transition_url
).
with
(
body:
message
).
once
end
it
"should initiate one api call to jira server to mention the issue"
do
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
it
"should initiate one api call to jira server to mention the issue"
do
skip
"This spec was broken during the CE-to-EE merge and needs to be fixed. See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/34"
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
expect
(
WebMock
).
to
have_requested
(
:post
,
jira_api_comment_url
).
with
(
body:
/mentioned this issue in/
).
once
end
end
expect
(
WebMock
).
to
have_requested
(
:post
,
jira_api_comment_url
).
with
(
body:
/mentioned this issue in/
).
once
context
"closing an issue"
do
let
(
:message
)
{
"this is some work.
\n\n
closes JIRA-1"
}
it
"should initiate one api call to jira server to close the issue"
do
body
=
{
update:
{
comment:
[{
add:
{
body:
"Issue solved with [
#{
closing_commit
.
id
}
|http://localhost/
#{
project
.
path_with_namespace
}
/commit/
#{
closing_commit
.
id
}
]."
}
}]
},
transition:
{
id:
'2'
}
}.
to_json
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
expect
(
WebMock
).
to
have_requested
(
:post
,
jira_api_transition_url
).
with
(
body:
body
).
once
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