diff options
Diffstat (limited to 'spec/lib/gitlab/ci/pipeline/expression/lexeme/not_matches_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/expression/lexeme/not_matches_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/expression/lexeme/not_matches_spec.rb b/spec/lib/gitlab/ci/pipeline/expression/lexeme/not_matches_spec.rb index 9bff2355d58..aad33106647 100644 --- a/spec/lib/gitlab/ci/pipeline/expression/lexeme/not_matches_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/expression/lexeme/not_matches_spec.rb @@ -1,9 +1,13 @@ # frozen_string_literal: true require 'fast_spec_helper' +require 'support/helpers/stubbed_feature' +require 'support/helpers/stub_feature_flags' require_dependency 're2' RSpec.describe Gitlab::Ci::Pipeline::Expression::Lexeme::NotMatches do + include StubFeatureFlags + let(:left) { double('left') } let(:right) { double('right') } @@ -148,5 +152,29 @@ RSpec.describe Gitlab::Ci::Pipeline::Expression::Lexeme::NotMatches do it { is_expected.to eq(true) } end + + context 'when right value is a regexp string' do + let(:right_value) { '/^ab.*/' } + + context 'when matching' do + let(:left_value) { 'abcde' } + + it { is_expected.to eq(false) } + + context 'when the FF ci_fix_rules_if_comparison_with_regexp_variable is disabled' do + before do + stub_feature_flags(ci_fix_rules_if_comparison_with_regexp_variable: false) + end + + it { is_expected.to eq(true) } + end + end + + context 'when not matching' do + let(:left_value) { 'dfg' } + + it { is_expected.to eq(true) } + end + end end end |