Commit 38e49069 authored by Matija Čupić's avatar Matija Čupić

Implement PipelineBridge service

parent 0be6a04d
# frozen_string_literal: true
module Ci
class PipelineBridgeService < ::BaseService
def execute(pipeline)
pipeline.bridged_jobs.each do |bridged_job|
bridged_job.update(status: pipeline.status)
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe Ci::PipelineBridgeService do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:pipeline) { create(:ci_pipeline, :success, project: project) }
describe '#execute' do
subject { described_class.new(project, user).execute(pipeline) }
context 'when pipeline has bridged jobs' do
let(:bridge) { create(:ci_bridge, status: :pending) }
before do
pipeline.bridged_jobs << bridge
end
it 'updates the bridge status with the pipeline status' do
expect { subject }.to change { bridge.status }.from('pending').to('success')
end
end
end
end
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