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

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

38 lines
794 B
Ruby
Raw Normal View History

2023-03-04 22:38:38 +05:30
# frozen_string_literal: true
RSpec.describe Gitlab::Ci::Config::Entry::Hooks do
subject(:entry) { described_class.new(config) }
before do
entry.compose!
end
describe 'validations' do
context 'when passing a valid hook' do
let(:config) { { pre_get_sources_script: ['ls'] } }
it { is_expected.to be_valid }
end
context 'when passing an invalid hook' do
let(:config) { { x_get_something: ['ls'] } }
it { is_expected.not_to be_valid }
end
context 'when entry config is not a hash' do
let(:config) { 'ls' }
it { is_expected.not_to be_valid }
end
end
describe '#value' do
let(:config) { { pre_get_sources_script: ['ls'] } }
it 'returns a hash' do
expect(entry.value).to eq(config)
end
end
end