diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/lib/gitlab/ci/config/entry/bridge_spec.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/bridge_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/bridge_spec.rb | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/bridge_spec.rb b/spec/lib/gitlab/ci/config/entry/bridge_spec.rb index c56f2d25074..8da46561b73 100644 --- a/spec/lib/gitlab/ci/config/entry/bridge_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/bridge_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Ci::Config::Entry::Bridge do - subject { described_class.new(config, name: :my_bridge) } + subject(:entry) { described_class.new(config, name: :my_bridge) } it_behaves_like 'with inheritable CI config' do let(:inheritable_key) { 'default' } @@ -380,4 +380,38 @@ RSpec.describe Gitlab::Ci::Config::Entry::Bridge do end end end + + describe '#when' do + context 'when bridge is a manual action' do + let(:config) { { script: 'deploy', when: 'manual' } } + + it { expect(entry.when).to eq('manual') } + end + + context 'when bridge has no `when` attribute' do + let(:config) { { script: 'deploy' } } + + it { expect(entry.when).to be_nil } + end + + context 'when the `when` keyword is not a string' do + context 'when it is an array' do + let(:config) { { script: 'exit 0', when: ['always'] } } + + it 'returns error' do + expect(entry).not_to be_valid + expect(entry.errors).to include 'bridge when should be a string' + end + end + + context 'when it is a boolean' do + let(:config) { { script: 'exit 0', when: true } } + + it 'returns error' do + expect(entry).not_to be_valid + expect(entry.errors).to include 'bridge when should be a string' + end + end + end + end end |