summaryrefslogtreecommitdiff
path: root/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb')
-rw-r--r--spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb b/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb
index 0e43fa024f3..492c6946c99 100644
--- a/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb
+++ b/spec/requests/api/graphql/mutations/ci/pipeline_schedule_play_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'PipelineSchedulePlay', feature_category: :continuious_integration do
+RSpec.describe 'PipelineSchedulePlay', feature_category: :continuous_integration do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
@@ -42,14 +42,18 @@ RSpec.describe 'PipelineSchedulePlay', feature_category: :continuious_integratio
end
end
- context 'when authorized' do
+ context 'when authorized', :sidekiq_inline do
before do
project.add_maintainer(user)
pipeline_schedule.update_columns(next_run_at: 2.hours.ago)
end
context 'when mutation succeeds' do
+ let(:service_response) { instance_double('ServiceResponse', payload: new_pipeline) }
+ let(:new_pipeline) { instance_double('Ci::Pipeline', persisted?: true) }
+
it do
+ expect(Ci::CreatePipelineService).to receive_message_chain(:new, :execute).and_return(service_response)
post_graphql_mutation(mutation, current_user: user)
expect(mutation_response['pipelineSchedule']['id']).to include(pipeline_schedule.id.to_s)
@@ -61,14 +65,10 @@ RSpec.describe 'PipelineSchedulePlay', feature_category: :continuious_integratio
end
context 'when mutation fails' do
- before do
- allow(RunPipelineScheduleWorker).to receive(:perform_async).and_return(nil)
- end
-
it do
expect(RunPipelineScheduleWorker)
.to receive(:perform_async)
- .with(pipeline_schedule.id, user.id)
+ .with(pipeline_schedule.id, user.id).and_return(nil)
post_graphql_mutation(mutation, current_user: user)