summaryrefslogtreecommitdiff
path: root/spec/services/ci/create_pipeline_service/custom_config_content_spec.rb
blob: 33cd6e164b05ef72da49200b01f895f22269e01e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true
require 'spec_helper'

describe Ci::CreatePipelineService do
  let_it_be(:project) { create(:project, :repository) }
  let_it_be(:user) { create(:admin) }
  let(:ref) { 'refs/heads/master' }
  let(:service) { described_class.new(project, user, { ref: ref }) }

  context 'custom config content' do
    let(:bridge) do
      double(:bridge, yaml_for_downstream: <<~YML
        rspec:
          script: rspec
        custom:
          script: custom
      YML
      )
    end

    subject { service.execute(:push, bridge: bridge) }

    it 'creates a pipeline using the content passed in as param' do
      expect(subject).to be_persisted
      expect(subject.builds.map(&:name)).to eq %w[rspec custom]
      expect(subject.config_source).to eq 'bridge_source'
    end
  end
end