diff options
Diffstat (limited to 'spec/lib/gitlab/ci/config/header/input_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/config/header/input_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/header/input_spec.rb b/spec/lib/gitlab/ci/config/header/input_spec.rb index b5155dff6e8..5d1fa4a8e6e 100644 --- a/spec/lib/gitlab/ci/config/header/input_spec.rb +++ b/spec/lib/gitlab/ci/config/header/input_spec.rb @@ -46,6 +46,12 @@ RSpec.describe Gitlab::Ci::Config::Header::Input, feature_category: :pipeline_co it_behaves_like 'a valid input' end + context 'when has a description value' do + let(:input_hash) { { description: 'bar' } } + + it_behaves_like 'a valid input' + end + context 'when is a required input' do let(:input_hash) { nil } @@ -62,6 +68,12 @@ RSpec.describe Gitlab::Ci::Config::Header::Input, feature_category: :pipeline_co end end + context 'when the input has RegEx validation' do + let(:input_hash) { { regex: '\w+' } } + + it_behaves_like 'a valid input' + end + context 'when given an invalid type' do let(:input_hash) { { type: 'datetime' } } let(:expected_errors) { ['foo input type unknown value: datetime'] } @@ -84,4 +96,11 @@ RSpec.describe Gitlab::Ci::Config::Header::Input, feature_category: :pipeline_co it_behaves_like 'an invalid input' end + + context 'when RegEx validation value is not a string' do + let(:input_hash) { { regex: [] } } + let(:expected_errors) { ['foo input regex should be a string'] } + + it_behaves_like 'an invalid input' + end end |