diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-06-30 15:23:46 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-06-30 15:23:46 +0800 |
commit | 17ba052f5c9d7c390b350469d15ffc674a943b07 (patch) | |
tree | 4b995a0b28d018d2b04b110d874c4211e009dcc6 /spec/models/ci | |
parent | 62fdbbeeb01810f9215a7b8bdf880901fcb48c65 (diff) | |
download | gitlab-ce-17ba052f5c9d7c390b350469d15ffc674a943b07.tar.gz |
Update wordings, allow only full path, add tests
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 5ed02031708..8d4d87def5e 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -748,47 +748,35 @@ describe Ci::Pipeline, models: true do end end - describe 'yaml config file resolution' do - let(:project) { FactoryGirl.build(:project) } + describe '#ci_yaml_file_path' do + let(:project) { create(:empty_project) } let(:pipeline) { create(:ci_empty_pipeline, project: project) } - it 'uses custom ci config file path when present' do + it 'returns the path from project' do allow(project).to receive(:ci_config_file) { 'custom/path' } - expect(pipeline.ci_yaml_file_path).to eq('custom/path/.gitlab-ci.yml') + expect(pipeline.ci_yaml_file_path).to eq('custom/path') end - it 'uses root when custom path is nil' do + it 'returns default when custom path is nil' do allow(project).to receive(:ci_config_file) { nil } expect(pipeline.ci_yaml_file_path).to eq('.gitlab-ci.yml') end - it 'uses root when custom path is empty' do + it 'returns default when custom path is empty' do allow(project).to receive(:ci_config_file) { '' } expect(pipeline.ci_yaml_file_path).to eq('.gitlab-ci.yml') end - it 'allows custom filename' do - allow(project).to receive(:ci_config_file) { 'custom/path/.my-config.yml' } - - expect(pipeline.ci_yaml_file_path).to eq('custom/path/.my-config.yml') - end - - it 'custom filename must be yml' do - allow(project).to receive(:ci_config_file) { 'custom/path/.my-config.cnf' } - - expect(pipeline.ci_yaml_file_path).to eq('custom/path/.my-config.cnf/.gitlab-ci.yml') - end - it 'reports error if the file is not found' do allow(project).to receive(:ci_config_file) { 'custom' } pipeline.ci_yaml_file expect(pipeline.yaml_errors) - .to eq('Failed to load CI/CD config file at custom/.gitlab-ci.yml') + .to eq('Failed to load CI/CD config file at custom') end end |