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
1c3121e5
Commit
1c3121e5
authored
Sep 03, 2019
by
Thong Kuah
Committed by
Jan Provaznik
Sep 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add facade which will always return nil in CE
This method will be overridden in EE
parent
d12a06b7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
0 deletions
+53
-0
app/presenters/clusterable_presenter.rb
app/presenters/clusterable_presenter.rb
+5
-0
ee/app/presenters/ee/group_clusterable_presenter.rb
ee/app/presenters/ee/group_clusterable_presenter.rb
+13
-0
ee/spec/presenters/group_clusterable_presenter_spec.rb
ee/spec/presenters/group_clusterable_presenter_spec.rb
+26
-0
spec/presenters/clusterable_presenter_spec.rb
spec/presenters/clusterable_presenter_spec.rb
+9
-0
No files found.
app/presenters/clusterable_presenter.rb
View file @
1c3121e5
...
...
@@ -53,6 +53,11 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
raise
NotImplementedError
end
# Will be overidden in EE
def
environments_cluster_path
(
cluster
)
nil
end
def
empty_state_help_text
nil
end
...
...
ee/app/presenters/ee/group_clusterable_presenter.rb
View file @
1c3121e5
...
...
@@ -8,5 +8,18 @@ module EE
def
metrics_cluster_path
(
cluster
,
params
=
{})
metrics_group_cluster_path
(
clusterable
,
cluster
,
params
)
end
override
:environments_cluster_path
def
environments_cluster_path
(
cluster
)
return
super
unless
can_read_cluster_environments?
environments_group_cluster_path
(
clusterable
,
cluster
)
end
private
def
can_read_cluster_environments?
can?
(
current_user
,
:read_cluster_environments
,
clusterable
)
end
end
end
ee/spec/presenters/group_clusterable_presenter_spec.rb
View file @
1c3121e5
...
...
@@ -5,6 +5,8 @@ require 'spec_helper'
describe
GroupClusterablePresenter
do
include
Gitlab
::
Routing
.
url_helpers
set
(
:user
)
{
create
(
:user
)
}
let
(
:presenter
)
{
described_class
.
new
(
group
)
}
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:group
)
}
let
(
:group
)
{
cluster
.
group
}
...
...
@@ -14,4 +16,28 @@ describe GroupClusterablePresenter do
it
{
is_expected
.
to
eq
(
metrics_group_cluster_path
(
group
,
cluster
))
}
end
describe
'#environments_cluster_path'
do
subject
{
presenter
.
environments_cluster_path
(
cluster
)
}
before
do
group
.
add_maintainer
(
user
)
allow
(
presenter
).
to
receive
(
:current_user
).
and_return
(
user
)
stub_licensed_features
(
cluster_deployments:
feature_available
)
end
context
'cluster_deployments feature is available'
do
let
(
:feature_available
)
{
true
}
it
{
is_expected
.
to
eq
(
environments_group_cluster_path
(
group
,
cluster
))
}
end
context
'cluster_deployments feature is not available'
do
let
(
:feature_available
)
{
false
}
it
{
is_expected
.
to
be_nil
}
end
end
end
spec/presenters/clusterable_presenter_spec.rb
View file @
1c3121e5
...
...
@@ -78,4 +78,13 @@ describe ClusterablePresenter do
it_behaves_like
'appropriate member permissions'
end
end
describe
'#environments_cluster_path'
do
subject
{
described_class
.
new
(
clusterable
).
environments_cluster_path
(
cluster
)
}
let
(
:clusterable
)
{
create
(
:group
)
}
let
(
:cluster
)
{
create
(
:cluster_for_group
,
groups:
[
clusterable
])
}
it
{
is_expected
.
to
be_nil
}
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