summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-08-12 13:57:58 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-08-12 13:57:58 +0200
commitea4ac578534d3a233c3525bf8351eb2045f6e632 (patch)
treed4c96a160a7281c3ea1492f38f2d2c2e123e57f1 /spec
parentd7b681512bb738b9b2ca0c56e761616a1a761295 (diff)
downloadgitlab-ce-ea4ac578534d3a233c3525bf8351eb2045f6e632.tar.gz
Use event `enqueue` instead of `queue`
Diffstat (limited to 'spec')
-rw-r--r--spec/models/build_spec.rb6
-rw-r--r--spec/models/ci/pipeline_spec.rb23
2 files changed, 23 insertions, 6 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index 60a221eba50..04fb074cfd8 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -886,8 +886,10 @@ describe Ci::Build, models: true do
is_expected.to eq(build)
end
- context 'for success build' do
- before { build.queue }
+ context 'for successful build' do
+ before do
+ build.success
+ end
it 'creates a new build' do
is_expected.to be_pending
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 28d07f67b26..950833cb219 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -143,7 +143,7 @@ describe Ci::Pipeline, models: true do
expect(pipeline.reload.started_at).not_to be_nil
end
- it 'do not update on transitioning to success' do
+ it 'does not update on transitioning to success' do
build.success
expect(pipeline.reload.started_at).to be_nil
@@ -157,7 +157,7 @@ describe Ci::Pipeline, models: true do
expect(pipeline.reload.finished_at).not_to be_nil
end
- it 'do not update on transitioning to running' do
+ it 'does not update on transitioning to running' do
build.run
expect(pipeline.reload.finished_at).to be_nil
@@ -257,14 +257,16 @@ describe Ci::Pipeline, models: true do
subject { pipeline.reload.status }
context 'on queuing' do
- before { build.queue }
+ before do
+ build.enqueue
+ end
it { is_expected.to eq('pending') }
end
context 'on run' do
before do
- build.queue
+ build.enqueue
build.run
end
@@ -294,5 +296,18 @@ describe Ci::Pipeline, models: true do
it { is_expected.to eq('canceled') }
end
+
+ context 'on failure and build retry' do
+ before do
+ build.drop
+ Ci::Build.retry(build)
+ end
+
+ # We are changing a state: created > failed > running
+ # Instead of: created > failed > pending
+ # Since the pipeline already run, so it should not be pending anymore
+
+ it { is_expected.to eq('running') }
+ end
end
end