debian-mirror-gitlab/spec/lib/gitlab/ci/config/entry/kubernetes_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.3 KiB
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Ci::Config::Entry::Kubernetes do
2021-06-08 01:23:25 +05:30
let(:config) { Hash(namespace: 'namespace') }
2020-01-01 13:55:28 +05:30
subject { described_class.new(config) }
describe 'attributes' do
it { is_expected.to respond_to(:namespace) }
it { is_expected.to respond_to(:has_namespace?) }
end
describe 'validations' do
describe 'config' do
context 'is a hash containing known keys' do
let(:config) { Hash(namespace: 'namespace') }
it { is_expected.to be_valid }
end
context 'is a hash containing an unknown key' do
let(:config) { Hash(unknown: 'attribute') }
it { is_expected.not_to be_valid }
end
context 'is a string' do
let(:config) { 'config' }
it { is_expected.not_to be_valid }
end
end
describe 'namespace' do
let(:config) { Hash(namespace: namespace) }
context 'is a string' do
let(:namespace) { 'namespace' }
it { is_expected.to be_valid }
end
context 'is a hash' do
let(:namespace) { Hash(key: 'namespace') }
it { is_expected.not_to be_valid }
end
context 'is not present' do
let(:namespace) { '' }
it { is_expected.not_to be_valid }
end
end
end
end