summaryrefslogtreecommitdiff
path: root/spec/views/projects/pipelines/new.html.haml_spec.rb
blob: 2deacfa8478eb0a28acdabd02a8ade79b3c5b74f (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
30
31
32
33
34
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'projects/pipelines/new' do
  include Devise::Test::ControllerHelpers
  let_it_be(:project) { create(:project, :repository) }
  let(:pipeline) { create(:ci_pipeline, project: project) }

  before do
    assign(:project, project)
    assign(:pipeline, pipeline)

    stub_feature_flags(new_pipeline_form: false)
  end

  describe 'warning messages' do
    let(:warning_messages) do
      [double(content: 'warning 1'), double(content: 'warning 2')]
    end

    before do
      allow(pipeline).to receive(:warning_messages).and_return(warning_messages)
    end

    it 'displays the warnings' do
      render

      expect(rendered).to have_css('div.alert-warning')
      expect(rendered).to have_content('warning 1')
      expect(rendered).to have_content('warning 2')
    end
  end
end