diff options
author | Leandro Camargo <leandroico@gmail.com> | 2016-11-26 01:02:08 -0200 |
---|---|---|
committer | Leandro Camargo <leandroico@gmail.com> | 2017-01-25 01:07:44 -0200 |
commit | f1e920ed86133bfea0abfc66ca44282813822073 (patch) | |
tree | fe6f35c9af1aa1d3d96e6f405692717299b80cc0 /spec/lib | |
parent | bb12ee051f95ee747c0e2b98a85675de53dca8ea (diff) | |
download | gitlab-ce-f1e920ed86133bfea0abfc66ca44282813822073.tar.gz |
Simplify coverage setting and comply to some requests in code review
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/coverage_spec.rb | 14 |
2 files changed, 11 insertions, 20 deletions
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index eb2d9c6e0e3..ac706216d5a 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -9,26 +9,17 @@ module Ci subject { described_class.new(config, path).build_attributes(:rspec) } let(:config_base) { { rspec: { script: "rspec" } } } - let(:config) { YAML.dump(config_base) } + let(:config) { YAML.dump(config_base) } context 'when config has coverage set at the global scope' do - before do - config_base.update( - coverage: { output_filter: '\(\d+\.\d+\) covered' } - ) - end + before { config_base.update(coverage: '\(\d+\.\d+\) covered') } - context 'and \'rspec\' job doesn\'t have coverage set' do + context "and 'rspec' job doesn't have coverage set" do it { is_expected.to include(coverage_regex: '\(\d+\.\d+\) covered') } end context 'but \'rspec\' job also has coverage set' do - before do - config_base[:rspec].update( - coverage: { output_filter: '/Code coverage: \d+\.\d+/' } - ) - end - + before { config_base[:rspec][:coverage] = '/Code coverage: \d+\.\d+/' } it { is_expected.to include(coverage_regex: 'Code coverage: \d+\.\d+') } 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 9e59755d9f8..0549dbc732b 100644 --- a/spec/lib/gitlab/ci/config/entry/coverage_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb @@ -5,35 +5,35 @@ describe Gitlab::Ci::Config::Entry::Coverage do describe 'validations' do context 'when entry config value is correct' do - let(:config) { { output_filter: 'Code coverage: \d+\.\d+' } } + let(:config) { 'Code coverage: \d+\.\d+' } describe '#value' do subject { entry.value } - it { is_expected.to eq config } + it { is_expected.to eq config } end describe '#errors' do subject { entry.errors } - it { is_expected.to be_empty } + it { is_expected.to be_empty } end describe '#valid?' do subject { entry } - it { is_expected.to be_valid } + it { is_expected.to be_valid } end end context 'when entry value is not correct' do - let(:config) { { output_filter: '(malformed regexp' } } + let(:config) { '(malformed regexp' } describe '#errors' do subject { entry.errors } - it { is_expected.to include /coverage output filter must be a regular expression/ } + it { is_expected.to include /coverage config must be a regular expression/ } end describe '#valid?' do subject { entry } - it { is_expected.not_to be_valid } + it { is_expected.not_to be_valid } end end end |