2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
RSpec.describe Ci::ProcessPipelineService, feature_category: :continuous_integration do
|
2021-06-08 01:23:25 +05:30
|
|
|
let_it_be(:project) { create(:project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_empty_pipeline, ref: 'master', project: project)
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
let(:pipeline_processing_events_counter) { double(increment: true) }
|
|
|
|
|
|
|
|
let(:metrics) do
|
2021-11-18 22:05:49 +05:30
|
|
|
double(pipeline_processing_events_counter: pipeline_processing_events_counter)
|
2021-04-29 21:17:54 +05:30
|
|
|
end
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
subject { described_class.new(pipeline) }
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
before do
|
2018-05-09 12:01:36 +05:30
|
|
|
stub_ci_pipeline_to_return_yaml_file
|
2017-09-10 17:25:29 +05:30
|
|
|
stub_not_protect_default_branch
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
allow(subject).to receive(:metrics).and_return(metrics)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
describe 'processing events counter' do
|
|
|
|
it 'increments processing events counter' do
|
2021-04-29 21:17:54 +05:30
|
|
|
expect(pipeline_processing_events_counter).to receive(:increment)
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
subject.execute
|
|
|
|
end
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|