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
6f1dda13
Commit
6f1dda13
authored
Jul 24, 2020
by
rpereira2
Committed by
Miguel Rincon
Jul 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine controller feature flag check and specs
parent
db22be51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
19 deletions
+9
-19
app/controllers/projects/metrics_dashboard_controller.rb
app/controllers/projects/metrics_dashboard_controller.rb
+1
-1
spec/requests/projects/metrics_dashboard_spec.rb
spec/requests/projects/metrics_dashboard_spec.rb
+8
-18
No files found.
app/controllers/projects/metrics_dashboard_controller.rb
View file @
6f1dda13
...
...
@@ -14,7 +14,7 @@ module Projects
end
def
show
if
!
Feature
.
enabled?
(
:metrics_dashboard_new_panel_page
)
&&
params
[
:page
].
present?
if
params
[
:page
].
present?
&&
!
Feature
.
enabled?
(
:metrics_dashboard_new_panel_page
,
project
)
return
render_404
end
...
...
spec/requests/projects/metrics_dashboard_spec.rb
View file @
6f1dda13
...
...
@@ -80,32 +80,22 @@ RSpec.describe 'metrics dashboard page' do
end
describe
'GET :/namespace/:project/-/metrics/:page'
do
context
'when metrics_dashboard_new_panel_page feature flag is disabled'
do
before
do
stub_feature_flags
(
metrics_dashboard_new_panel_page:
false
)
end
it
'returns 404 if feature flag disabled'
do
# send_request(page: 'panel/new') cannot be used because it encodes '/'
get
"/
#{
project
.
namespace
.
to_param
}
/
#{
project
.
to_param
}
/-/metrics/panel/new"
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
it
'returns 200 with path param page and feature flag enabled'
do
stub_feature_flags
(
metrics_dashboard_new_panel_page:
true
)
it
'returns 200 without page'
do
send_request
# send_request(page: 'panel/new') cannot be used because it encodes '/'
get
"/
#{
project
.
namespace
.
to_param
}
/
#{
project
.
to_param
}
/-/metrics/panel/new"
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'returns
200 if feature flag is en
abled'
do
stub_feature_flags
(
metrics_dashboard_new_panel_page:
tru
e
)
it
'returns
404 with path param page and feature flag dis
abled'
do
stub_feature_flags
(
metrics_dashboard_new_panel_page:
fals
e
)
# send_request(page: 'panel/new') cannot be used because it encodes '/'
get
"/
#{
project
.
namespace
.
to_param
}
/
#{
project
.
to_param
}
/-/metrics/panel/new"
expect
(
response
).
to
have_gitlab_http_status
(
:
ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:
not_found
)
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