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
2e622553
Commit
2e622553
authored
Jul 12, 2019
by
Winnie Hellmann
Committed by
Jan Provaznik
Jul 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split and prepend CurrentBoardEntity
(cherry picked from commit 1e8bdd01bff96122fe80c51fa8f024f18675b58b)
parent
4c6bdd23
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
3 deletions
+46
-3
app/helpers/boards_helper.rb
app/helpers/boards_helper.rb
+5
-1
app/serializers/current_board_entity.rb
app/serializers/current_board_entity.rb
+6
-0
app/serializers/current_board_serializer.rb
app/serializers/current_board_serializer.rb
+5
-0
spec/fixtures/api/schemas/current-board.json
spec/fixtures/api/schemas/current-board.json
+16
-0
spec/helpers/boards_helper_spec.rb
spec/helpers/boards_helper_spec.rb
+14
-2
No files found.
app/helpers/boards_helper.rb
View file @
2e622553
...
@@ -99,7 +99,11 @@ module BoardsHelper
...
@@ -99,7 +99,11 @@ module BoardsHelper
recent_project_boards_path
(
@project
)
if
current_board_parent
.
is_a?
(
Project
)
recent_project_boards_path
(
@project
)
if
current_board_parent
.
is_a?
(
Project
)
end
end
def
serializer
CurrentBoardSerializer
.
new
end
def
current_board_json
def
current_board_json
board
.
to
_json
serializer
.
represent
(
board
).
as
_json
end
end
end
end
app/serializers/current_board_entity.rb
0 → 100644
View file @
2e622553
# frozen_string_literal: true
class
CurrentBoardEntity
<
Grape
::
Entity
expose
:id
expose
:name
end
app/serializers/current_board_serializer.rb
0 → 100644
View file @
2e622553
# frozen_string_literal: true
class
CurrentBoardSerializer
<
BaseSerializer
entity
CurrentBoardEntity
end
spec/fixtures/api/schemas/current-board.json
0 → 100644
View file @
2e622553
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"board.json"
},
{
"required"
:
[
"id"
,
"name"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
}
}
}
]
}
spec/helpers/boards_helper_spec.rb
View file @
2e622553
require
'spec_helper'
require
'spec_helper'
describe
BoardsHelper
do
describe
BoardsHelper
do
set
(
:project
)
{
create
(
:project
)
}
describe
'#build_issue_link_base'
do
describe
'#build_issue_link_base'
do
context
'project board'
do
context
'project board'
do
it
'returns correct path for project board'
do
it
'returns correct path for project board'
do
@project
=
create
(
:project
)
@project
=
project
@board
=
create
(
:board
,
project:
@project
)
@board
=
create
(
:board
,
project:
@project
)
expect
(
build_issue_link_base
).
to
eq
(
"/
#{
@project
.
namespace
.
path
}
/
#{
@project
.
path
}
/issues"
)
expect
(
build_issue_link_base
).
to
eq
(
"/
#{
@project
.
namespace
.
path
}
/
#{
@project
.
path
}
/issues"
)
...
@@ -31,7 +33,6 @@ describe BoardsHelper do
...
@@ -31,7 +33,6 @@ describe BoardsHelper do
describe
'#board_data'
do
describe
'#board_data'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
before
do
before
do
...
@@ -46,4 +47,15 @@ describe BoardsHelper do
...
@@ -46,4 +47,15 @@ describe BoardsHelper do
expect
(
helper
.
board_data
[
:lists_endpoint
]).
to
eq
(
board_lists_path
(
board
))
expect
(
helper
.
board_data
[
:lists_endpoint
]).
to
eq
(
board_lists_path
(
board
))
end
end
end
end
describe
'#current_board_json'
do
let
(
:board_json
)
{
helper
.
current_board_json
}
it
'can serialise with a basic set of attributes'
do
board
=
create
(
:board
,
project:
project
)
assign
(
:board
,
board
)
expect
(
board_json
).
to
match_schema
(
'current-board'
)
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