diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-17 18:21:36 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-17 18:33:47 +0300 |
commit | 58a56a03967a407bf376f960809d3398a3153645 (patch) | |
tree | e76fcc3719ab30f96043e5de0b646229ea1a7452 /spec | |
parent | b2c593dac513c0e12153e0aa786759c4ebc996bc (diff) |
Don't create CI status for refs that doesn't have .gitlab-ci.yml, even if the builds are enabled
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/create_commit_builds_service_spec.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/spec/services/create_commit_builds_service_spec.rb b/spec/services/create_commit_builds_service_spec.rb index 40ba6549e1f..ea5dcfa068a 100644 --- a/spec/services/create_commit_builds_service_spec.rb +++ b/spec/services/create_commit_builds_service_spec.rb @@ -52,7 +52,7 @@ describe CreateCommitBuildsService, services: true do end end - it 'skips commits without .gitlab-ci.yml' do + it 'skips creating ci_commit for refs without .gitlab-ci.yml' do stub_ci_commit_yaml_file(nil) result = service.execute(project, user, ref: 'refs/heads/0_1', @@ -60,13 +60,11 @@ describe CreateCommitBuildsService, services: true do after: '31das312', commits: [{ message: 'Message' }] ) - expect(result).to be_persisted - expect(result.builds.any?).to be_falsey - expect(result.status).to eq('skipped') - expect(result.yaml_errors).to be_nil + expect(result).to be_falsey + expect(Ci::Commit.count).to eq(0) end - it 'skips commits if yaml is invalid' do + it 'fails commits if yaml is invalid' do message = 'message' allow_any_instance_of(Ci::Commit).to receive(:git_commit_message) { message } stub_ci_commit_yaml_file('invalid: file: file') @@ -77,6 +75,7 @@ describe CreateCommitBuildsService, services: true do after: '31das312', commits: commits ) + expect(commit).to be_persisted expect(commit.builds.any?).to be false expect(commit.status).to eq('failed') expect(commit.yaml_errors).to_not be_nil @@ -97,6 +96,7 @@ describe CreateCommitBuildsService, services: true do after: '31das312', commits: commits ) + expect(commit).to be_persisted expect(commit.builds.any?).to be false expect(commit.status).to eq("skipped") end @@ -112,6 +112,7 @@ describe CreateCommitBuildsService, services: true do commits: commits ) + expect(commit).to be_persisted expect(commit.builds.first.name).to eq("staging") end @@ -124,6 +125,7 @@ describe CreateCommitBuildsService, services: true do after: '31das312', commits: commits ) + expect(commit).to be_persisted expect(commit.builds.any?).to be false expect(commit.status).to eq("skipped") expect(commit.yaml_errors).to be_nil @@ -140,6 +142,7 @@ describe CreateCommitBuildsService, services: true do after: '31das312', commits: commits ) + expect(commit).to be_persisted expect(commit.builds.count(:all)).to eq(2) commit = service.execute(project, user, @@ -148,6 +151,7 @@ describe CreateCommitBuildsService, services: true do after: '31das312', commits: commits ) + expect(commit).to be_persisted expect(commit.builds.count(:all)).to eq(2) end @@ -163,6 +167,7 @@ describe CreateCommitBuildsService, services: true do commits: commits ) + expect(commit).to be_persisted expect(commit.status).to eq("failed") expect(commit.builds.any?).to be false end |