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
928fbeee
Commit
928fbeee
authored
Apr 02, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More tests for Isses services
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
1b5fb4ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
2 deletions
+57
-2
spec/services/issues/close_service_spec.rb
spec/services/issues/close_service_spec.rb
+35
-0
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+22
-2
No files found.
spec/services/issues/close_service_spec.rb
0 → 100644
View file @
928fbeee
require
'spec_helper'
describe
Issues
::
CloseService
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
assignee:
user2
)
}
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user2
,
:developer
]
end
describe
:execute
do
context
"valid params"
do
before
do
@issue
=
Issues
::
CloseService
.
new
(
project
,
user
,
{}).
execute
(
issue
)
end
it
{
@issue
.
should
be_valid
}
it
{
@issue
.
should
be_closed
}
it
'should send email to user2 about assign of new issue'
do
email
=
ActionMailer
::
Base
.
deliveries
.
last
email
.
to
.
first
.
should
==
user2
.
email
email
.
subject
.
should
include
(
issue
.
title
)
end
it
'should create system note about issue reassign'
do
note
=
@issue
.
notes
.
last
note
.
note
.
should
include
"Status changed to closed"
end
end
end
end
spec/services/issues/update_service_spec.rb
View file @
928fbeee
...
...
@@ -3,15 +3,22 @@ require 'spec_helper'
describe
Issues
::
UpdateService
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
)
}
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user2
,
:developer
]
end
describe
:execute
do
context
"valid params"
do
before
do
project
.
team
<<
[
user
,
:master
]
opts
=
{
title:
'New title'
,
description:
'Also please fix'
description:
'Also please fix'
,
assignee_id:
user2
.
id
,
state_event:
'close'
}
@issue
=
Issues
::
UpdateService
.
new
(
project
,
user
,
opts
).
execute
(
issue
)
...
...
@@ -19,6 +26,19 @@ describe Issues::UpdateService do
it
{
@issue
.
should
be_valid
}
it
{
@issue
.
title
.
should
==
'New title'
}
it
{
@issue
.
assignee
.
should
==
user2
}
it
{
@issue
.
should
be_closed
}
it
'should send email to user2 about assign of new issue'
do
email
=
ActionMailer
::
Base
.
deliveries
.
last
email
.
to
.
first
.
should
==
user2
.
email
email
.
subject
.
should
include
(
issue
.
title
)
end
it
'should create system note about issue reassign'
do
note
=
@issue
.
notes
.
last
note
.
note
.
should
include
"Reassigned to
\@
#{
user2
.
username
}
"
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