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
543193af
Commit
543193af
authored
Feb 14, 2021
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Epic boards show page
- raise 404 if board is nil
parent
051aedb1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
6 deletions
+85
-6
app/controllers/concerns/boards_responses.rb
app/controllers/concerns/boards_responses.rb
+5
-1
ee/app/views/groups/epic_boards/show.html.haml
ee/app/views/groups/epic_boards/show.html.haml
+1
-0
ee/config/routes/group.rb
ee/config/routes/group.rb
+1
-1
ee/spec/controllers/groups/epic_boards_controller_spec.rb
ee/spec/controllers/groups/epic_boards_controller_spec.rb
+78
-4
No files found.
app/controllers/concerns/boards_responses.rb
View file @
543193af
...
@@ -66,7 +66,11 @@ module BoardsResponses
...
@@ -66,7 +66,11 @@ module BoardsResponses
end
end
def
respond_with_board
def
respond_with_board
respond_with
(
@board
)
# rubocop:disable Gitlab/ModuleWithInstanceVariables
# rubocop:disable Gitlab/ModuleWithInstanceVariables
return
render_404
unless
@board
respond_with
(
@board
)
# rubocop:enable Gitlab/ModuleWithInstanceVariables
end
end
def
serialize_as_json
(
resource
)
def
serialize_as_json
(
resource
)
...
...
ee/app/views/groups/epic_boards/show.html.haml
0 → 100644
View file @
543193af
=
render
"shared/boards/show"
,
board:
@board
,
group:
true
ee/config/routes/group.rb
View file @
543193af
...
@@ -138,7 +138,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
...
@@ -138,7 +138,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
end
end
end
end
resources
:epic_boards
,
only:
[
:index
]
resources
:epic_boards
,
only:
[
:index
,
:show
]
namespace
:security
do
namespace
:security
do
resource
:dashboard
,
only:
[
:show
],
controller: :dashboard
resource
:dashboard
,
only:
[
:show
],
controller: :dashboard
...
...
ee/spec/controllers/groups/epic_boards_controller_spec.rb
View file @
543193af
...
@@ -3,8 +3,12 @@
...
@@ -3,8 +3,12 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
Groups
::
EpicBoardsController
do
RSpec
.
describe
Groups
::
EpicBoardsController
do
let
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:public_group
)
{
create
(
:group
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:private_group
)
{
create
(
:group
,
:private
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:other_user
)
{
create
(
:user
)
}
let
(
:group
)
{
public_group
}
before
do
before
do
group
.
add_maintainer
(
user
)
group
.
add_maintainer
(
user
)
...
@@ -17,8 +21,6 @@ RSpec.describe Groups::EpicBoardsController do
...
@@ -17,8 +21,6 @@ RSpec.describe Groups::EpicBoardsController do
end
end
context
'with unauthorized user'
do
context
'with unauthorized user'
do
let
(
:other_user
)
{
create
(
:user
)
}
before
do
before
do
sign_in
(
other_user
)
sign_in
(
other_user
)
end
end
...
@@ -47,4 +49,76 @@ RSpec.describe Groups::EpicBoardsController do
...
@@ -47,4 +49,76 @@ RSpec.describe Groups::EpicBoardsController do
get
:index
,
params:
{
group_id:
group
},
format:
format
get
:index
,
params:
{
group_id:
group
},
format:
format
end
end
end
end
describe
'GET show'
do
let!
(
:board
)
{
create
(
:epic_board
,
group:
group
)
}
context
'json request'
do
it
'is not supported'
do
read_board
(
board:
board
,
format: :json
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'when format is HTML'
do
it
'renders template'
do
# epic board visits not supported yet
expect
{
read_board
board:
board
}.
not_to
change
(
BoardGroupRecentVisit
,
:count
)
expect
(
response
).
to
render_template
:show
expect
(
response
.
media_type
).
to
eq
'text/html'
end
context
'with unauthorized user'
do
let
(
:group
)
{
private_group
}
before
do
sign_in
(
other_user
)
end
it
'returns a not found 404 response'
do
read_board
board:
board
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
response
.
media_type
).
to
eq
'text/html'
end
end
context
'when user is signed out'
do
let
(
:group
)
{
public_group
}
it
'does not save visit'
do
sign_out
(
user
)
# epic board visits not supported yet
expect
{
read_board
board:
board
}.
not_to
change
(
BoardGroupRecentVisit
,
:count
)
expect
(
response
).
to
render_template
:show
expect
(
response
.
media_type
).
to
eq
'text/html'
end
end
end
context
'when epic board does not belong to group'
do
it
'returns a not found 404 response'
do
another_board
=
create
(
:epic_board
)
read_board
board:
another_board
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it_behaves_like
'disabled when using an external authorization service'
do
subject
{
read_board
board:
board
}
end
def
read_board
(
board
:,
format: :html
)
get
:show
,
params:
{
group_id:
group
,
id:
board
.
to_param
},
format:
format
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