Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-13 16:18:34 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-13 16:18:34 +0300
commit7f0ecf3a97a20a0b274ebfd46e762afad05870fc (patch)
treef9dcc31830b5b1c90fbc9b05c2c1fc3cce62ec09 /spec
parentd7a774320e9e79bebb57dbbb927ff6af6d09e0e2 (diff)
Add missing tests for build `cancelable?` method
Diffstat (limited to 'spec')
-rw-r--r--spec/models/build_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index e9b4cac5fef..ac596ce4a91 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -899,6 +899,42 @@ describe Ci::Build, models: true do
end
end
+ describe '#cancelable?' do
+ subject { build }
+
+ context 'when build is cancelable' do
+ context 'when build is pending' do
+ it { is_expected.to be_cancelable }
+ end
+
+ context 'when build is running' do
+ before do
+ build.run!
+ end
+
+ it { is_expected.to be_cancelable }
+ end
+ end
+
+ context 'when build is not cancelable' do
+ context 'when build is successful' do
+ before do
+ build.success!
+ end
+
+ it { is_expected.not_to be_cancelable }
+ end
+
+ context 'when build is failed' do
+ before do
+ build.drop!
+ end
+
+ it { is_expected.not_to be_cancelable }
+ end
+ end
+ end
+
describe '#retryable?' do
subject { build }