Commit 3c5c6c2c authored by Thong Kuah's avatar Thong Kuah

Address BE review - re-arrange some specs

parent 6cba2698
......@@ -8,12 +8,11 @@ describe Clusters::Gcp::Kubernetes::CreateServiceAccountService do
let(:service) { described_class.new(kubeclient, rbac: rbac) }
describe '#execute' do
subject { service.execute }
let(:rbac) { false }
let(:api_url) { 'http://111.111.111.111' }
let(:username) { 'admin' }
let(:password) { 'xxx' }
let(:kubeclient) do
Gitlab::Kubernetes::KubeClient.new(
api_url,
......@@ -22,6 +21,8 @@ describe Clusters::Gcp::Kubernetes::CreateServiceAccountService do
)
end
subject { service.execute }
context 'when params are correct' do
before do
stub_kubeclient_discover(api_url)
......
# frozen_string_literal: true
require 'fast_spec_helper'
describe Clusters::Gcp::Kubernetes::FetchKubernetesTokenService do
describe '#execute' do
subject { described_class.new(kubeclient).execute }
let(:api_url) { 'http://111.111.111.111' }
let(:username) { 'admin' }
let(:password) { 'xxx' }
......@@ -16,6 +16,8 @@ describe Clusters::Gcp::Kubernetes::FetchKubernetesTokenService do
)
end
subject { described_class.new(kubeclient).execute }
context 'when params correct' do
let(:decoded_token) { 'xxx.token.xxx' }
let(:token) { Base64.encode64(decoded_token) }
......
......@@ -32,10 +32,11 @@ end
shared_examples 'create cluster service success' do
before do
stub_feature_flags(rbac_clusters: false)
expect(ClusterProvisionWorker).to receive(:perform_async)
end
it 'creates a cluster object and performs a worker' do
expect(ClusterProvisionWorker).to receive(:perform_async)
expect { subject }
.to change { Clusters::Cluster.count }.by(1)
.and change { Clusters::Providers::Gcp.count }.by(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment