summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/config/entry/coverage_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/coverage_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/config/entry/coverage_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/coverage_spec.rb b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb
new file mode 100644
index 00000000000..9e59755d9f8
--- /dev/null
+++ b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb
@@ -0,0 +1,40 @@
+require 'spec_helper'
+
+describe Gitlab::Ci::Config::Entry::Coverage do
+ let(:entry) { described_class.new(config) }
+
+ describe 'validations' do
+ context 'when entry config value is correct' do
+ let(:config) { { output_filter: '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 }
+ end
+
+ describe '#valid?' do
+ subject { entry }
+ it { is_expected.to be_valid }
+ end
+ end
+
+ context 'when entry value is not correct' do
+ let(:config) { { output_filter: '(malformed regexp' } }
+
+ describe '#errors' do
+ subject { entry.errors }
+ it { is_expected.to include /coverage output filter must be a regular expression/ }
+ end
+
+ describe '#valid?' do
+ subject { entry }
+ it { is_expected.not_to be_valid }
+ end
+ end
+ end
+end