summaryrefslogtreecommitdiff
path: root/spec/models/clusters/kubernetes_namespace_spec.rb
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-11-13 10:27:21 +0000
committerKamil TrzciƄski <ayufan@ayufan.eu>2018-11-13 10:27:21 +0000
commit5d2fd2ea9e9518b53292d678526563527dd7c76c (patch)
treea2f869c2d0b3de2aaa8cc469406e8cfb6aac5e32 /spec/models/clusters/kubernetes_namespace_spec.rb
parent91f117274ecb803cd2833fffe5e2807eccdf5b73 (diff)
downloadgitlab-ce-5d2fd2ea9e9518b53292d678526563527dd7c76c.tar.gz
Fix deployment jobs using nil token
Diffstat (limited to 'spec/models/clusters/kubernetes_namespace_spec.rb')
-rw-r--r--spec/models/clusters/kubernetes_namespace_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/clusters/kubernetes_namespace_spec.rb b/spec/models/clusters/kubernetes_namespace_spec.rb
index 0dfeea5cd2f..c068c4d7739 100644
--- a/spec/models/clusters/kubernetes_namespace_spec.rb
+++ b/spec/models/clusters/kubernetes_namespace_spec.rb
@@ -8,6 +8,22 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do
it { is_expected.to belong_to(:cluster) }
it { is_expected.to have_one(:platform_kubernetes) }
+ describe 'has_service_account_token' do
+ subject { described_class.has_service_account_token }
+
+ context 'namespace has service_account_token' do
+ let!(:namespace) { create(:cluster_kubernetes_namespace, :with_token) }
+
+ it { is_expected.to include(namespace) }
+ end
+
+ context 'namespace has no service_account_token' do
+ let!(:namespace) { create(:cluster_kubernetes_namespace) }
+
+ it { is_expected.not_to include(namespace) }
+ end
+ end
+
describe 'namespace uniqueness validation' do
let(:cluster_project) { create(:cluster_project) }
let(:kubernetes_namespace) { build(:cluster_kubernetes_namespace, namespace: 'my-namespace') }