BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b56965c5
Commit
b56965c5
authored
Jun 17, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly checks if user is logged in when adding todo
parent
85fab13e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
todos_controller.rb
app/controllers/projects/todos_controller.rb
+1
-1
todo_controller_spec.rb
spec/controllers/projects/todo_controller_spec.rb
+13
-0
No files found.
app/controllers/projects/todos_controller.rb
View file @
b56965c5
class
Projects
::
TodosController
<
Projects
::
ApplicationController
before_action
:auth
orize_read_issue
!
,
only:
[
:create
]
before_action
:auth
enticate_user
!
,
only:
[
:create
]
def
create
todo
=
TodoService
.
new
.
mark_todo
(
issuable
,
current_user
)
...
...
spec/controllers/projects/todo_controller_spec.rb
View file @
b56965c5
...
...
@@ -39,4 +39,17 @@ describe Projects::TodosController do
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
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