2019-04-11 08:17:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-11 09:22:35 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Ci::ProcessPipelineService do
|
2021-05-02 11:09:53 -04:00
|
|
|
let_it_be(:project) { create(:project) }
|
2017-02-13 07:19:23 -05:00
|
|
|
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_empty_pipeline, ref: 'master', project: project)
|
|
|
|
end
|
|
|
|
|
2021-04-15 11:09:11 -04:00
|
|
|
let(:pipeline_processing_events_counter) { double(increment: true) }
|
|
|
|
|
|
|
|
let(:metrics) do
|
2021-09-30 11:12:24 -04:00
|
|
|
double(pipeline_processing_events_counter: pipeline_processing_events_counter)
|
2021-04-15 11:09:11 -04:00
|
|
|
end
|
|
|
|
|
2020-07-15 08:09:26 -04:00
|
|
|
subject { described_class.new(pipeline) }
|
|
|
|
|
2017-02-13 07:19:23 -05:00
|
|
|
before do
|
2018-02-27 21:56:18 -05:00
|
|
|
stub_ci_pipeline_to_return_yaml_file
|
2017-07-18 10:32:34 -04:00
|
|
|
stub_not_protect_default_branch
|
|
|
|
|
2021-04-15 11:09:11 -04:00
|
|
|
allow(subject).to receive(:metrics).and_return(metrics)
|
2017-02-13 07:19:23 -05:00
|
|
|
end
|
2016-08-11 09:22:35 -04:00
|
|
|
|
2020-07-15 08:09:26 -04:00
|
|
|
describe 'processing events counter' do
|
|
|
|
it 'increments processing events counter' do
|
2021-04-15 11:09:11 -04:00
|
|
|
expect(pipeline_processing_events_counter).to receive(:increment)
|
2020-07-15 08:09:26 -04:00
|
|
|
|
|
|
|
subject.execute
|
|
|
|
end
|
|
|
|
end
|
2016-08-11 09:22:35 -04:00
|
|
|
end
|