diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-08-06 00:47:56 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-08-06 00:55:34 +0200 |
commit | 3890f722d2bdd8964bac776f92772cc447d2b44c (patch) | |
tree | cb107744ee0ccc2a8c620fd76def22ec1f0d47f0 | |
parent | 47f6dd69eb7db707f2e6631173adfc4878127141 (diff) | |
download | gitlab-ci-3890f722d2bdd8964bac776f92772cc447d2b44c.tar.gz |
Fix broken yaml error saving
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/commit.rb | 2 | ||||
-rw-r--r-- | spec/services/create_commit_service_spec.rb | 15 |
3 files changed, 17 insertions, 1 deletions
@@ -10,6 +10,7 @@ v7.14.0 (unreleased) - Fix project API listing returning empty list when first projects are not added to CI - Allow to define variables from YAML - Added support for CI skipped status + - Fix broken yaml error saving - Rename type(s) to stage(s) v7.13.1 diff --git a/app/models/commit.rb b/app/models/commit.rb index c7e2d8b..ec65d19 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -250,7 +250,7 @@ class Commit < ActiveRecord::Base private def save_yaml_error(error) - return unless self.yaml_errors? + return if self.yaml_errors? self.yaml_errors = error save end diff --git a/spec/services/create_commit_service_spec.rb b/spec/services/create_commit_service_spec.rb index c72ba6b..13f9663 100644 --- a/spec/services/create_commit_service_spec.rb +++ b/spec/services/create_commit_service_spec.rb @@ -98,5 +98,20 @@ describe CreateCommitService do ) commit.builds.count(:all).should == 2 end + + it "creates commit with failed status if yaml is invalid" do + commits = [{message: "some message"}] + + commit = service.execute(project, + ref: 'refs/tags/0_1', + before: '00000000', + after: '31das312', + commits: commits, + ci_yaml_file: "invalid: file" + ) + + commit.status.should == "failed" + commit.builds.any?.should be_false + end end end |