summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/services/ci/retry_build_service_spec.rb16
-rw-r--r--spec/services/ci/retry_pipeline_service_spec.rb12
2 files changed, 14 insertions, 14 deletions
diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb
index 0815469f2cb..9cd1da59c54 100644
--- a/spec/services/ci/retry_build_service_spec.rb
+++ b/spec/services/ci/retry_build_service_spec.rb
@@ -7,13 +7,13 @@ describe Ci::RetryBuildService, :services do
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:service) do
- described_class.new(build, user)
+ described_class.new(project, user)
end
- describe '#retry!' do
- let(:new_build) { service.retry! }
+ describe '#execute' do
+ let(:new_build) { service.execute(build) }
- context 'when user has ability to retry build' do
+ context 'when user has ability to execute build' do
before do
project.team << [user, :developer]
end
@@ -30,7 +30,7 @@ describe Ci::RetryBuildService, :services do
expect(MergeRequests::AddTodoWhenBuildFailsService)
.to receive_message_chain(:new, :close)
- service.retry!
+ service.execute(build)
end
context 'when there are subsequent builds that are skipped' do
@@ -39,16 +39,16 @@ describe Ci::RetryBuildService, :services do
end
it 'resumes pipeline processing in subsequent stages' do
- service.retry!
+ service.execute(build)
expect(subsequent_build.reload).to be_created
end
end
end
- context 'when user does not have ability to retry build' do
+ context 'when user does not have ability to execute build' do
it 'raises an error' do
- expect { service.retry! }
+ expect { service.execute(build) }
.to raise_error Gitlab::Access::AccessDeniedError
end
end
diff --git a/spec/services/ci/retry_pipeline_service_spec.rb b/spec/services/ci/retry_pipeline_service_spec.rb
index aeb3ee228ad..d7afca538aa 100644
--- a/spec/services/ci/retry_pipeline_service_spec.rb
+++ b/spec/services/ci/retry_pipeline_service_spec.rb
@@ -4,7 +4,7 @@ describe Ci::RetryPipelineService, '#execute', :services do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:pipeline) { create(:ci_pipeline, project: project) }
- let(:service) { described_class.new(pipeline, user) }
+ let(:service) { described_class.new(project, user) }
context 'when user has ability to modify pipeline' do
let(:user) { create(:admin) }
@@ -17,7 +17,7 @@ describe Ci::RetryPipelineService, '#execute', :services do
end
it 'enqueues all builds in the last stage' do
- service.execute
+ service.execute(pipeline)
expect(build('rspec 2')).to be_pending
expect(build('rspec 3')).to be_pending
@@ -34,7 +34,7 @@ describe Ci::RetryPipelineService, '#execute', :services do
end
it 'retries builds failed builds and marks subsequent for processing' do
- service.execute
+ service.execute(pipeline)
expect(build('rspec 1')).to be_pending
expect(build('rspec 2')).to be_pending
@@ -53,7 +53,7 @@ describe Ci::RetryPipelineService, '#execute', :services do
end
it 'retries builds failed builds and marks subsequent for processing' do
- service.execute
+ service.execute(pipeline)
expect(build('rspec 1')).to be_pending
expect(build('rspec 2')).to be_pending
@@ -63,7 +63,7 @@ describe Ci::RetryPipelineService, '#execute', :services do
end
it 'creates a new job for report job in this case' do
- service.execute
+ service.execute(pipeline)
expect(statuses.where(name: 'report 1').count).to eq 2
end
@@ -72,7 +72,7 @@ describe Ci::RetryPipelineService, '#execute', :services do
context 'when user is not allowed to retry pipeline' do
it 'raises an error' do
- expect { service.execute }
+ expect { service.execute(pipeline) }
.to raise_error Gitlab::Access::AccessDeniedError
end
end