summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-28 14:24:43 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-30 11:06:19 +0200
commitf9c5f18d448de3fefced3149550263adc83af1bf (patch)
treeee5f5b467ff1c53ec91c5c6003e77243a281b8af /spec/models
parent94cec500c534ac8b35d7d7d9c807646faa800fec (diff)
downloadgitlab-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.rb18
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