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
7cb360d8
Commit
7cb360d8
authored
Nov 24, 2017
by
Matija Čupić
Committed by
Shinya Maeda
Dec 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ClustersHelper with ee cluster button logic
parent
4c25ecfd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
ee/app/helpers/clusters_helper.rb
ee/app/helpers/clusters_helper.rb
+7
-0
spec/ee/spec/helpers/clusters_helper_spec.rb
spec/ee/spec/helpers/clusters_helper_spec.rb
+48
-0
No files found.
ee/app/helpers/clusters_helper.rb
0 → 100644
View file @
7cb360d8
module
ClustersHelper
def
enable_add_cluster_button?
(
project
)
return
true
if
project
.
clusters
.
empty?
project
.
feature_available?
(
:multiple_clusters
)
end
end
spec/ee/spec/helpers/clusters_helper_spec.rb
0 → 100644
View file @
7cb360d8
require
'spec_helper'
describe
ClustersHelper
do
include
ApplicationHelper
describe
'.enable_add_cluster_button?'
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:user
)
{
create
(
:user
)
}
subject
{
helper
.
enable_add_cluster_button?
(
project
)
}
context
'when project does not have a cluster'
do
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when project has a cluster'
do
before
do
params
=
{
name:
'test-cluster'
,
provider_type: :gcp
,
provider_gcp_attributes:
{
gcp_project_id:
'gcp-project'
,
zone:
'us-central1-a'
,
num_nodes:
1
,
machine_type:
'machine_type-a'
}
}
Clusters
::
Cluster
.
create
(
params
.
merge
(
user:
user
,
projects:
[
project
]))
end
context
'when project has multiple clusters available'
do
before
do
allow
(
project
).
to
receive
(
:feature_available?
).
with
(
:multiple_clusters
).
and_return
(
true
)
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when project does not have multiple clusters available'
do
before
do
allow
(
project
).
to
receive
(
:feature_available?
).
with
(
:multiple_clusters
).
and_return
(
false
)
end
it
{
is_expected
.
to
eq
(
false
)
}
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