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
11dd2348
Commit
11dd2348
authored
Mar 01, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '22951-fix-todos-api-endpoint-error-for-commits' into 'master'
Fix todos API endpoint application error Closes #22951 See merge request !9351
parents
e7fb3942
54c1dc67
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
8 deletions
+17
-8
22951-fix-todos-api-endpoint-error-for-commits.yml
...leased/22951-fix-todos-api-endpoint-error-for-commits.yml
+4
-0
entities.rb
lib/api/entities.rb
+2
-1
todos.rb
spec/factories/todos.rb
+9
-5
todos_spec.rb
spec/requests/api/todos_spec.rb
+2
-2
No files found.
changelogs/unreleased/22951-fix-todos-api-endpoint-error-for-commits.yml
0 → 100644
View file @
11dd2348
---
title
:
Add spec for todo with target_type Commit
merge_request
:
9351
author
:
George Andrinopoulos
lib/api/entities.rb
View file @
11dd2348
...
...
@@ -394,7 +394,8 @@ module API
expose
:target_type
expose
:target
do
|
todo
,
options
|
Entities
.
const_get
(
todo
.
target_type
).
represent
(
todo
.
target
,
options
)
target
=
todo
.
target_type
==
'Commit'
?
'RepoCommit'
:
todo
.
target_type
Entities
.
const_get
(
target
).
represent
(
todo
.
target
,
options
)
end
expose
:target_url
do
|
todo
,
options
|
...
...
spec/factories/todos.rb
View file @
11dd2348
...
...
@@ -18,11 +18,6 @@ FactoryGirl.define do
action
{
Todo
::
DIRECTLY_ADDRESSED
}
end
trait
:on_commit
do
commit_id
RepoHelpers
.
sample_commit
.
id
target_type
"Commit"
end
trait
:build_failed
do
action
{
Todo
::
BUILD_FAILED
}
target
factory: :merge_request
...
...
@@ -48,4 +43,13 @@ FactoryGirl.define do
state
:done
end
end
factory
:on_commit_todo
,
class:
Todo
do
project
factory: :empty_project
author
user
action
{
Todo
::
ASSIGNED
}
commit_id
RepoHelpers
.
sample_commit
.
id
target_type
"Commit"
end
end
spec/requests/api/todos_spec.rb
View file @
11dd2348
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
API
::
Todos
,
api:
true
do
include
ApiHelpers
let
(
:project_1
)
{
create
(
:empty_project
)
}
let
(
:project_1
)
{
create
(
:empty_project
,
:test_repo
)
}
let
(
:project_2
)
{
create
(
:empty_project
)
}
let
(
:author_1
)
{
create
(
:user
)
}
let
(
:author_2
)
{
create
(
:user
)
}
...
...
@@ -11,7 +11,7 @@ describe API::Todos, api: true do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project_1
)
}
let!
(
:pending_1
)
{
create
(
:todo
,
:mentioned
,
project:
project_1
,
author:
author_1
,
user:
john_doe
)
}
let!
(
:pending_2
)
{
create
(
:todo
,
project:
project_2
,
author:
author_2
,
user:
john_doe
)
}
let!
(
:pending_3
)
{
create
(
:todo
,
project:
project_1
,
author:
author_2
,
user:
john_doe
)
}
let!
(
:pending_3
)
{
create
(
:
on_commit_
todo
,
project:
project_1
,
author:
author_2
,
user:
john_doe
)
}
let!
(
:done
)
{
create
(
:todo
,
:done
,
project:
project_1
,
author:
author_1
,
user:
john_doe
)
}
before
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