diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-02-26 20:32:23 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-02-26 20:32:23 +0300 |
commit | 7b445f9b15c31f7b2b53561901183ab23db2d636 (patch) | |
tree | 21640c40aea443139e1a9e31b2ea606115cf9916 /spec/models/concerns/maskable_spec.rb | |
parent | 48e6db0dad6f256e8423e0bd6c9b254803f50ccf (diff) |
Revert "Merge branch '13784-simple-masking-of-protected-variables-in-logs' into 'master'"
This reverts merge request !25293
Diffstat (limited to 'spec/models/concerns/maskable_spec.rb')
-rw-r--r-- | spec/models/concerns/maskable_spec.rb | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/spec/models/concerns/maskable_spec.rb b/spec/models/concerns/maskable_spec.rb deleted file mode 100644 index aeba7ad862f..00000000000 --- a/spec/models/concerns/maskable_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Maskable do - let(:variable) { build(:ci_variable) } - - describe 'masked value validations' do - subject { variable } - - context 'when variable is masked' do - before do - subject.masked = true - end - - it { is_expected.not_to allow_value('hello').for(:value) } - it { is_expected.not_to allow_value('hello world').for(:value) } - it { is_expected.not_to allow_value('hello$VARIABLEworld').for(:value) } - it { is_expected.not_to allow_value('hello\rworld').for(:value) } - it { is_expected.to allow_value('helloworld').for(:value) } - end - - context 'when variable is not masked' do - before do - subject.masked = false - end - - it { is_expected.to allow_value('hello').for(:value) } - it { is_expected.to allow_value('hello world').for(:value) } - it { is_expected.to allow_value('hello$VARIABLEworld').for(:value) } - it { is_expected.to allow_value('hello\rworld').for(:value) } - it { is_expected.to allow_value('helloworld').for(:value) } - end - end - - describe 'REGEX' do - subject { Maskable::REGEX } - - it 'does not match strings shorter than 8 letters' do - expect(subject.match?('hello')).to eq(false) - end - - it 'does not match strings with spaces' do - expect(subject.match?('hello world')).to eq(false) - end - - it 'does not match strings with shell variables' do - expect(subject.match?('hello$VARIABLEworld')).to eq(false) - end - - it 'does not match strings with escape characters' do - expect(subject.match?('hello\rworld')).to eq(false) - end - - it 'does not match strings that span more than one line' do - string = <<~EOS - hello - world - EOS - - expect(subject.match?(string)).to eq(false) - end - - it 'matches valid strings' do - expect(subject.match?('helloworld')).to eq(true) - end - end - - describe '#to_runner_variable' do - subject { variable.to_runner_variable } - - it 'exposes the masked attribute' do - expect(subject).to include(:masked) - end - end -end |