Commit b49e7966 authored by Rydkin Maxim's avatar Rydkin Maxim

refactor spec

parent d2f2168b
...@@ -47,31 +47,28 @@ describe Ci::CreatePipelineService, services: true do ...@@ -47,31 +47,28 @@ describe Ci::CreatePipelineService, services: true do
pipeline pipeline
pipeline_on_previous_commit pipeline_on_previous_commit
expect(pipeline.reload) expect(pipeline.reload).to have_attributes(status: 'pending', auto_canceled_by_id: nil)
.to have_attributes(status: 'pending', auto_canceled_by_id: nil)
end end
it 'auto cancel pending non-HEAD pipelines' do it 'auto cancel pending non-HEAD pipelines' do
pending_pipeline = pipeline_on_previous_commit pipeline_on_previous_commit
pipeline pipeline
expect(pending_pipeline.reload).to have_attributes(status: 'canceled', auto_canceled_by_id: pipeline.id) expect(pipeline_on_previous_commit.reload).to have_attributes(status: 'canceled', auto_canceled_by_id: pipeline.id)
end end
it 'does not cancel running outdated pipelines' do it 'does not cancel running outdated pipelines' do
running_pipeline = pipeline_on_previous_commit pipeline_on_previous_commit.run
running_pipeline.run
execute_service execute_service
expect(running_pipeline.reload).to have_attributes(status: 'running', auto_canceled_by_id: nil) expect(pipeline_on_previous_commit.reload).to have_attributes(status: 'running', auto_canceled_by_id: nil)
end end
it 'cancel created outdated pipelines' do it 'cancel created outdated pipelines' do
created_pipeline = pipeline_on_previous_commit pipeline_on_previous_commit.update(status: 'created')
created_pipeline.update(status: 'created')
pipeline pipeline
expect(created_pipeline.reload).to have_attributes(status: 'canceled', auto_canceled_by_id: pipeline.id) expect(pipeline_on_previous_commit.reload).to have_attributes(status: 'canceled', auto_canceled_by_id: pipeline.id)
end end
it 'does not cancel pipelines from the other branches' do it 'does not cancel pipelines from the other branches' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment