diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-10-06 17:06:55 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-10-06 17:06:55 +0000 |
commit | fb70fadaca6d2ce30730e9a6c995ad8e4f0526e3 (patch) | |
tree | 846e43a446ab90c4320cee4d1c1379851ebb10ea /spec/policies | |
parent | a68a39e34120e0cf67d95e143326d03f61288cdf (diff) | |
parent | 86cea3a544951b1d2fd9795c6ffb83e98cbd97cd (diff) | |
download | gitlab-ce-fb70fadaca6d2ce30730e9a6c995ad8e4f0526e3.tar.gz |
Merge branch 'feature/sm/35954-create-kubernetes-cluster-on-gke-from-k8s-service' into 'master'
Create Kubernetes cluster on GKE from k8s service
Closes #35954
See merge request gitlab-org/gitlab-ce!14470
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/gcp/cluster_policy_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/policies/gcp/cluster_policy_spec.rb b/spec/policies/gcp/cluster_policy_spec.rb new file mode 100644 index 00000000000..e213aa3d557 --- /dev/null +++ b/spec/policies/gcp/cluster_policy_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe Gcp::ClusterPolicy, :models do + set(:project) { create(:project) } + set(:cluster) { create(:gcp_cluster, project: project) } + let(:user) { create(:user) } + let(:policy) { described_class.new(user, cluster) } + + describe 'rules' do + context 'when developer' do + before do + project.add_developer(user) + end + + it { expect(policy).to be_disallowed :update_cluster } + it { expect(policy).to be_disallowed :admin_cluster } + end + + context 'when master' do + before do + project.add_master(user) + end + + it { expect(policy).to be_allowed :update_cluster } + it { expect(policy).to be_allowed :admin_cluster } + end + end +end |