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
Tatuya Kamada
gitlab-ce
Commits
90029a5c
Commit
90029a5c
authored
Dec 31, 2015
by
Mike Wyatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually test the posted comment in Asana service
parent
9e7a88f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
spec/models/project_services/asana_service_spec.rb
spec/models/project_services/asana_service_spec.rb
+21
-4
No files found.
spec/models/project_services/asana_service_spec.rb
View file @
90029a5c
...
...
@@ -40,6 +40,20 @@ describe AsanaService, models: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
def
create_data_for_commits
(
*
messages
)
data
=
{
object_kind:
'push'
,
ref:
'master'
,
user_name:
user
.
name
,
commits:
messages
.
map
do
|
m
|
{
message:
m
,
url:
'https://gitlab.com/'
,
}
end
}
end
before
do
@asana
=
AsanaService
.
new
allow
(
@asana
).
to
receive_messages
(
...
...
@@ -51,12 +65,15 @@ describe AsanaService, models: true do
)
end
it
'should call Asana service to created a story'
do
d1
=
double
(
'Asana::Task'
,
add_comment:
true
)
expect
(
d1
).
to
receive
(
:add_comment
)
it
'should call Asana service to create a story'
do
data
=
create_data_for_commits
(
'Message from commit. related to #123456'
)
expected_message
=
"
#{
data
[
:user_name
]
}
pushed to branch
#{
data
[
:ref
]
}
of
#{
project
.
name_with_namespace
}
(
#{
data
[
:commits
][
0
][
:url
]
}
):
#{
data
[
:commits
][
0
][
:message
]
}
"
d1
=
double
(
'Asana::Task'
)
expect
(
d1
).
to
receive
(
:add_comment
).
with
(
text:
expected_message
)
expect
(
Asana
::
Task
).
to
receive
(
:find_by_id
).
with
(
anything
,
'123456'
).
once
.
and_return
(
d1
)
@asana
.
check_commit
(
'related to #123456'
,
'pushed'
)
@asana
.
execute
(
data
)
end
it
'should call Asana service to created a story and close a task'
do
...
...
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