From be7106a145b1e3d4c6e06503e0f7f3032ace3764 Mon Sep 17 00:00:00 2001 From: Leandro Camargo Date: Wed, 7 Dec 2016 03:01:34 -0200 Subject: Force coverage value to always be surrounded by '/' --- spec/lib/gitlab/ci/config/entry/coverage_spec.rb | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'spec/lib/gitlab/ci/config/entry/coverage_spec.rb') diff --git a/spec/lib/gitlab/ci/config/entry/coverage_spec.rb b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb index 8f989ebd732..eb04075f1be 100644 --- a/spec/lib/gitlab/ci/config/entry/coverage_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb @@ -4,31 +4,26 @@ describe Gitlab::Ci::Config::Entry::Coverage do let(:entry) { described_class.new(config) } describe 'validations' do - context "when entry config value is correct without surrounding '/'" do + context "when entry config value doesn't have the surrounding '/'" do let(:config) { 'Code coverage: \d+\.\d+' } - describe '#value' do - subject { entry.value } - it { is_expected.to eq(config) } - end - describe '#errors' do subject { entry.errors } - it { is_expected.to be_empty } + it { is_expected.to include(/coverage config must be a regular expression/) } end describe '#valid?' do subject { entry } - it { is_expected.to be_valid } + it { is_expected.not_to be_valid } end end - context "when entry config value is correct with surrounding '/'" do + context "when entry config value has the surrounding '/'" do let(:config) { '/Code coverage: \d+\.\d+/' } describe '#value' do subject { entry.value } - it { is_expected.to eq(config[1...-1]) } + it { is_expected.to eq(config) } end describe '#errors' do @@ -42,7 +37,7 @@ describe Gitlab::Ci::Config::Entry::Coverage do end end - context 'when entry value is not correct' do + context 'when entry value is not valid' do let(:config) { '(malformed regexp' } describe '#errors' do -- cgit v1.2.1