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
60b40492
Commit
60b40492
authored
Jun 17, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added todo controller tests for merge requests
parent
7c95dc41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
37 deletions
+90
-37
spec/controllers/projects/todo_controller_spec.rb
spec/controllers/projects/todo_controller_spec.rb
+90
-37
No files found.
spec/controllers/projects/todo_controller_spec.rb
View file @
60b40492
require
(
'spec_helper'
)
describe
Projects
::
TodosController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
describe
'POST #create'
do
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
context
'Issues'
do
describe
'POST #create'
do
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
end
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
issue
.
id
,
issuable_type:
"issue"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
200
)
end
end
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
issue
.
id
,
issuable_type:
"issue"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
1
)
describe
'POST #create when not authorized'
do
before
do
sign_in
(
user
)
end
expect
(
response
.
status
).
to
eq
(
200
)
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
issue
.
id
,
issuable_type:
"issue"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
0
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
describe
'POST #create when not logged in'
do
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
issue
.
id
,
issuable_type:
"issue"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
0
)
expect
(
response
.
status
).
to
eq
(
302
)
end
end
end
describe
'POST #create when not authorized'
do
before
do
sign_in
(
user
)
context
'Merge Requests'
do
describe
'POST #create'
do
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
end
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
merge_request
.
id
,
issuable_type:
"merge_request"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
200
)
end
end
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
issue
.
id
,
issuable_type:
"issue"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
0
)
describe
'POST #create when not authorized'
do
before
do
sign_in
(
user
)
end
expect
(
response
.
status
).
to
eq
(
404
)
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
merge_request
.
id
,
issuable_type:
"merge_request"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
0
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
describe
'POST #create when not logged in'
do
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
issue
.
id
,
issuable_type:
"issue
"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
0
)
describe
'POST #create when not logged in'
do
it
'should create todo for issue'
do
expect
do
post
(
:create
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
issuable_id:
merge_request
.
id
,
issuable_type:
"merge_request
"
)
end
.
to
change
{
user
.
todos
.
count
}.
by
(
0
)
expect
(
response
.
status
).
to
eq
(
302
)
expect
(
response
.
status
).
to
eq
(
302
)
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