summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 21:20:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-28 21:20:15 +0000
commit92d5172ad42ebc62eb78cac21b1e236ad6ace580 (patch)
treeca89437d4725caeb4e27682522061d3bab7e05b0 /spec/support
parentf4a969f7f495978a7e656c69c929c9fdac111cff (diff)
downloadgitlab-ce-92d5172ad42ebc62eb78cac21b1e236ad6ace580.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/controllers/clusters_controller_shared_examples.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/support/shared_examples/controllers/clusters_controller_shared_examples.rb b/spec/support/shared_examples/controllers/clusters_controller_shared_examples.rb
new file mode 100644
index 00000000000..aa17e72d08e
--- /dev/null
+++ b/spec/support/shared_examples/controllers/clusters_controller_shared_examples.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'GET new cluster shared examples' do
+ describe 'EKS cluster' do
+ context 'user already has an associated AWS role' do
+ let!(:role) { create(:aws_role, user: user) }
+
+ it 'does not create an Aws::Role record' do
+ expect { go(provider: 'aws') }.not_to change { Aws::Role.count }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(assigns(:aws_role)).to eq(role)
+ end
+ end
+
+ context 'user does not have an associated AWS role' do
+ it 'creates an Aws::Role record' do
+ expect { go(provider: 'aws') }.to change { Aws::Role.count }
+
+ expect(response).to have_gitlab_http_status(:ok)
+
+ role = assigns(:aws_role)
+ expect(role.user).to eq(user)
+ expect(role.role_arn).to be_nil
+ expect(role.role_external_id).to be_present
+ end
+ end
+ end
+end