diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-28 14:24:43 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-30 11:06:19 +0200 |
commit | f9c5f18d448de3fefced3149550263adc83af1bf (patch) | |
tree | ee5f5b467ff1c53ec91c5c6003e77243a281b8af /spec/models | |
parent | 94cec500c534ac8b35d7d7d9c807646faa800fec (diff) | |
download | gitlab-ce-f9c5f18d448de3fefced3149550263adc83af1bf.tar.gz |
Improve method that tells if build is retryable
This method now should return false if build is not completed. If build
is running then it is not retryable, therefore `Ci::Build#retryable?`
returned wrong value. This commit changes this behavior
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/build_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 8154001cf46..97b28686d82 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -669,4 +669,22 @@ describe Ci::Build, models: true do expect(build.commit).to eq project.commit end end + + describe '#retryable?' do + context 'when build is running' do + before { build.run! } + + it 'should return false' do + expect(build.retryable?).to be false + end + end + + context 'when build is finished' do + before { build.success! } + + it 'should return true' do + expect(build.retryable?).to be true + end + end + end end |