summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorLeandro Camargo <leandroico@gmail.com>2016-12-07 03:01:34 -0200
committerLeandro Camargo <leandroico@gmail.com>2017-01-25 01:07:44 -0200
commitbe7106a145b1e3d4c6e06503e0f7f3032ace3764 (patch)
treeeade35f3dbfa182058388094e11fd983274e1eae /spec/lib
parentf8bec0d1fb05d2c3e87a0470579ee7a650ade23c (diff)
downloadgitlab-ce-be7106a145b1e3d4c6e06503e0f7f3032ace3764.tar.gz
Force coverage value to always be surrounded by '/'
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/ci/gitlab_ci_yaml_processor_spec.rb6
-rw-r--r--spec/lib/gitlab/ci/config/entry/coverage_spec.rb17
2 files changed, 9 insertions, 14 deletions
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
index b1e09350847..e2302f5968a 100644
--- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
@@ -13,11 +13,11 @@ module Ci
context 'when config has coverage set at the global scope' do
before do
- config_base.update(coverage: '\(\d+\.\d+\) covered')
+ config_base.update(coverage: '/\(\d+\.\d+\) covered/')
end
context "and 'rspec' job doesn't have coverage set" do
- it { is_expected.to include(coverage_regex: '\(\d+\.\d+\) covered') }
+ it { is_expected.to include(coverage_regex: '/\(\d+\.\d+\) covered/') }
end
context "but 'rspec' job also has coverage set" do
@@ -25,7 +25,7 @@ module Ci
config_base[:rspec][:coverage] = '/Code coverage: \d+\.\d+/'
end
- it { is_expected.to include(coverage_regex: 'Code coverage: \d+\.\d+') }
+ it { is_expected.to include(coverage_regex: '/Code coverage: \d+\.\d+/') }
end
end
end
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