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
03f16a95
Commit
03f16a95
authored
Feb 04, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add git push service spec in case jira service is enabled.
parent
c4b97dc2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
24 deletions
+77
-24
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+77
-24
No files found.
spec/services/git_push_service_spec.rb
View file @
03f16a95
...
...
@@ -201,9 +201,10 @@ describe GitPushService do
let
(
:commit_author
)
{
create
:user
}
let
(
:closing_commit
)
{
project
.
repository
.
commit
}
context
"for default gitlab issue tracker"
do
before
do
closing_commit
.
stub
({
issue_closing_regex:
/^([Cc]loses|[Ff]ixes) #\d+/
,
issue_closing_regex:
Regexp
.
new
(
Gitlab
.
config
.
gitlab
.
issue_closing_pattern
)
,
safe_message:
"this is some work.
\n\n
closes #
#{
issue
.
iid
}
"
,
author_name:
commit_author
.
name
,
author_email:
commit_author
.
email
...
...
@@ -235,5 +236,57 @@ describe GitPushService do
Issue
.
find
(
issue
.
id
).
should
be_opened
end
end
context
"for jira issue tracker"
do
let
(
:api_url
)
{
'http://jira.example/rest/api/2/issue/JIRA-1/transitions'
}
let
(
:jira_tracker
)
{
project
.
create_jira_service
if
project
.
jira_service
.
nil?
}
before
do
properties
=
{
"title"
=>
"JIRA tracker"
,
"project_url"
=>
"http://jira.example/issues/?jql=project=A"
,
"issues_url"
=>
"http://jira.example/browse/JIRA-1"
,
"new_issue_url"
=>
"http://jira.example/secure/CreateIssue.jspa"
}
jira_tracker
.
update_attributes
(
properties:
properties
,
active:
true
)
WebMock
.
stub_request
(
:post
,
api_url
)
closing_commit
.
stub
({
issue_closing_regex:
Regexp
.
new
(
Gitlab
.
config
.
gitlab
.
issue_closing_pattern
),
safe_message:
"this is some work.
\n\n
closes JIRA-1"
,
author_name:
commit_author
.
name
,
author_email:
commit_author
.
email
})
project
.
repository
.
stub
(
commits_between:
[
closing_commit
])
end
after
do
jira_tracker
.
destroy!
end
it
"should initiate one api call to jira server"
do
message
=
{
'update'
=>
{
'comment'
=>
[{
'add'
=>
{
'body'
=>
"Issue solved with http://localhost/
#{
project
.
path_with_namespace
}
/commit/
#{
closing_commit
.
id
}
"
}
}]
},
'transition'
=>
{
'id'
=>
'2'
}
}.
to_json
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
WebMock
.
should
have_requested
(
:post
,
api_url
).
with
(
body:
message
).
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