diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-10-18 14:13:26 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-10-18 14:13:26 +0200 |
commit | 39dac14e9caad660487eb106428369663767d127 (patch) | |
tree | a38ba54cf140b7d4df3d29abb9ccbf8eeee66cb9 /spec | |
parent | e0830a748a9efe817bcc48f7d0bf7fc5282f58ea (diff) | |
download | gitlab-ce-39dac14e9caad660487eb106428369663767d127.tar.gz |
Refactor `include` code and improve error reporting
Diffstat (limited to 'spec')
4 files changed, 9 insertions, 6 deletions
diff --git a/spec/lib/gitlab/ci/config/external/file/local_spec.rb b/spec/lib/gitlab/ci/config/external/file/local_spec.rb index 5c0e2eee71f..2708d8d5b6b 100644 --- a/spec/lib/gitlab/ci/config/external/file/local_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/local_spec.rb @@ -72,7 +72,7 @@ describe Gitlab::Ci::Config::External::File::Local do let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' } it 'should return an error message' do - expect(local_file.error_message).to eq("Local file '#{location}' is not valid.") + expect(local_file.error_message).to eq("Local file `#{location}` does not exist!") end end end diff --git a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb index 72853797bcd..e4682852014 100644 --- a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb @@ -108,7 +108,7 @@ describe Gitlab::Ci::Config::External::File::Remote do let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } it 'should return an error message' do - expect(remote_file.error_message).to eq("Remote file '#{location}' is not valid.") + expect(remote_file.error_message).to eq("Remote file `#{location}` does not have a valid address!") end end end diff --git a/spec/lib/gitlab/ci/config/external/processor_spec.rb b/spec/lib/gitlab/ci/config/external/processor_spec.rb index ede6e769cfe..1a05f716247 100644 --- a/spec/lib/gitlab/ci/config/external/processor_spec.rb +++ b/spec/lib/gitlab/ci/config/external/processor_spec.rb @@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::External::Processor do it 'should raise an error' do expect { processor.perform }.to raise_error( described_class::IncludeError, - "Local file '/lib/gitlab/ci/templates/non-existent-file.yml' is not valid." + "Local file `/lib/gitlab/ci/templates/non-existent-file.yml` does not exist!" ) end end @@ -37,7 +37,7 @@ describe Gitlab::Ci::Config::External::Processor do it 'should raise an error' do expect { processor.perform }.to raise_error( described_class::IncludeError, - "Remote file '#{remote_file}' is not valid." + "Remote file `#{remote_file}` could not be fetched because of a socket error!" ) end end @@ -159,7 +159,10 @@ describe Gitlab::Ci::Config::External::Processor do end it 'should raise an error' do - expect { processor.perform }.to raise_error(Gitlab::Ci::Config::Loader::FormatError) + expect { processor.perform }.to raise_error( + described_class::IncludeError, + "Included file `/lib/gitlab/ci/templates/template.yml` does not have valid YAML syntax!" + ) end end diff --git a/spec/lib/gitlab/ci/config_spec.rb b/spec/lib/gitlab/ci/config_spec.rb index 8925b17be58..975e11e8cc1 100644 --- a/spec/lib/gitlab/ci/config_spec.rb +++ b/spec/lib/gitlab/ci/config_spec.rb @@ -201,7 +201,7 @@ describe Gitlab::Ci::Config do it 'raises error YamlProcessor validationError' do expect { config }.to raise_error( described_class::ConfigError, - "Local file 'invalid' is not valid." + "Included file `invalid` does not have YAML extension!" ) end end |