summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-02-18 14:08:50 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-02-18 14:08:50 +0100
commitbee26f9c4ef3c3cb1b1d3eb88500220823a7d7fb (patch)
tree35074bb2f908c09abe3b2097f5062f65c5b00214
parent52d5eefd1fbb0af68c541b3d23397501f665dfa0 (diff)
downloadgitlab-ce-bee26f9c4ef3c3cb1b1d3eb88500220823a7d7fb.tar.gz
Add specs covering bug in build allowed to fail case
-rw-r--r--spec/models/ci/commit_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb
index dfc0cc3be1c..4dc309a4255 100644
--- a/spec/models/ci/commit_spec.rb
+++ b/spec/models/ci/commit_spec.rb
@@ -247,6 +247,35 @@ describe Ci::Commit, models: true do
end
end
+
+ context 'custom stage with first job allowed to fail' do
+ let(:yaml) do
+ {
+ stages: ['clean', 'test'],
+ clean_job: {
+ stage: 'clean',
+ allow_failure: true,
+ script: 'BUILD',
+ },
+ test_job: {
+ stage: 'test',
+ script: 'TEST',
+ },
+ }
+ end
+
+ before do
+ stub_ci_commit_yaml_file(YAML.dump(yaml))
+ create_builds
+ end
+
+ it 'properly schedules builds' do
+ expect(commit.builds.pluck(:status)).to contain_exactly('pending')
+ commit.builds.running_or_pending.each(&:drop)
+ expect(commit.builds.pluck(:status)).to contain_exactly('pending', 'failed')
+ end
+ end
+
context 'properly creates builds when "when" is defined' do
let(:yaml) do
{