diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-19 21:48:57 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-19 23:51:41 +0300 |
commit | b876993677edde4fee3a8ed349c522f1542190f7 (patch) | |
tree | 4d764eec3bcd36e9cd9154b892fd3ba2d5bb7169 /spec/workers/post_receive_spec.rb | |
parent | 86b22b4f153610993008e5f6fa65bca1fb57b659 (diff) |
Fix creation of Ci::Commit object which can lead to pending, failed in some scenarios
Diffstat (limited to 'spec/workers/post_receive_spec.rb')
-rw-r--r-- | spec/workers/post_receive_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 94ff3457902..2f465bcf1e3 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -48,6 +48,22 @@ describe PostReceive do PostReceive.new.perform(pwd(project), key_id, base64_changes) end end + + context "gitlab-ci.yml" do + subject { PostReceive.new.perform(pwd(project), key_id, base64_changes) } + + context "creates a Ci::Commit for every change" do + before { stub_ci_commit_to_return_yaml_file } + + it { expect{ subject }.to change{ Ci::Commit.count }.by(2) } + end + + context "does not create a Ci::Commit" do + before { stub_ci_commit_yaml_file(nil) } + + it { expect{ subject }.to_not change{ Ci::Commit.count } } + end + end end context "webhook" do |