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