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

68 lines
1.4 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2016-09-13 17:45:13 +05:30
require 'spec_helper'
2017-08-17 22:00:37 +05:30
describe Gitlab::Ci::Config::Entry::Hidden do
2019-09-30 21:07:59 +05:30
describe '.matching?' do
subject { described_class.matching?(name, {}) }
2016-09-13 17:45:13 +05:30
2019-09-30 21:07:59 +05:30
context 'when name starts with dot' do
let(:name) { '.hidden_job' }
2016-09-13 17:45:13 +05:30
2019-09-30 21:07:59 +05:30
it { is_expected.to be_truthy }
end
context 'when name does not start with dot' do
let(:name) { 'rspec' }
it { is_expected.to be_falsey }
end
end
describe '.new' do
let(:entry) { described_class.new(config) }
describe 'validations' do
context 'when entry config value is correct' do
let(:config) { [:some, :array] }
describe '#value' do
it 'returns key value' do
expect(entry.value).to eq [:some, :array]
end
2016-09-13 17:45:13 +05:30
end
2019-09-30 21:07:59 +05:30
describe '#valid?' do
it 'is valid' do
expect(entry).to be_valid
end
2016-09-13 17:45:13 +05:30
end
end
2019-09-30 21:07:59 +05:30
context 'when entry value is not correct' do
context 'when config is empty' do
let(:config) { {} }
2016-09-13 17:45:13 +05:30
2019-09-30 21:07:59 +05:30
describe '#valid' do
it 'is invalid' do
expect(entry).not_to be_valid
end
2016-09-13 17:45:13 +05:30
end
end
end
end
2019-09-30 21:07:59 +05:30
describe '#leaf?' do
it 'is a leaf' do
expect(entry).to be_leaf
end
2016-09-13 17:45:13 +05:30
end
2019-09-30 21:07:59 +05:30
describe '#relevant?' do
it 'is not a relevant entry' do
expect(entry).not_to be_relevant
end
2016-09-13 17:45:13 +05:30
end
end
end