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
a0f77817
Commit
a0f77817
authored
Nov 06, 2019
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for all_dashboards edit_path
parent
74613d28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
spec/controllers/concerns/metrics_dashboard_spec.rb
spec/controllers/concerns/metrics_dashboard_spec.rb
+22
-1
No files found.
spec/controllers/concerns/metrics_dashboard_spec.rb
View file @
a0f77817
...
...
@@ -3,9 +3,11 @@
require
'spec_helper'
describe
MetricsDashboard
do
include
MetricsDashboardHelpers
describe
'GET #metrics_dashboard'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:project
)
{
project_with_dashboard
(
'.gitlab/dashboards/test.yml'
)
}
let_it_be
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
before
do
...
...
@@ -63,6 +65,25 @@ describe MetricsDashboard do
expect
(
json_response
[
'dashboard'
][
'dashboard'
]).
to
eq
(
'Environment metrics'
)
expect
(
json_response
).
to
have_key
(
'all_dashboards'
)
end
context
'in all_dashboard list'
do
context
'when a user can collaborate on project'
do
it
'includes edit_path only for project dashboards'
do
expect
(
json_response
[
'all_dashboards'
][
0
][
'edit_path'
]).
to
be_nil
expect
(
json_response
[
'all_dashboards'
][
1
][
'edit_path'
]).
to
eq
(
'/namespace1/project1/blob/master/.gitlab/dashboards/test.yml'
)
end
end
context
'when user does not have permissions to edit project dashboard'
do
before
do
allow
(
controller
).
to
receive
(
:can_collaborate_with_project?
).
and_return
(
false
)
end
it
'does not include edit_path for project dashboards'
do
expect
(
json_response
[
'all_dashboards'
][
1
][
'edit_path'
]).
to
be_nil
end
end
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