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
Boxiang Sun
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
app/controllers/projects/todos_controller.rb
app/controllers/projects/todos_controller.rb
+1
-1
spec/controllers/projects/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
class
Projects::TodosController
<
Projects
::
ApplicationController
before_action
:auth
orize_read_issue
!
,
only:
[
:create
]
before_action
:auth
enticate_user
!
,
only:
[
:create
]
def
create
def
create
todo
=
TodoService
.
new
.
mark_todo
(
issuable
,
current_user
)
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
...
@@ -39,4 +39,17 @@ describe Projects::TodosController do
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
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
)
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