Welcome to mirror list, hosted at ThFree Co, Russian Federation.

autodevops_disabled_email.text.erb_spec.rb « notify « views « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8299d637e1af3688ae870520a11074260c9d692 (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
35
36
37
38
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'notify/autodevops_disabled_email.text.erb' do
  include Devise::Test::ControllerHelpers

  let(:user) { create(:user, developer_projects: [project]) }
  let(:project) { create(:project, :repository) }

  let(:pipeline) do
    create(:ci_pipeline,
           :failed,
           project: project,
           user: user,
           ref: project.default_branch,
           sha: project.commit.sha)
  end

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

  context 'when the pipeline contains a failed job' do
    let!(:build) { create(:ci_build, :failed, :trace_live, pipeline: pipeline, project: pipeline.project) }

    it 'renders the email correctly' do
      render

      expect(rendered).to have_content("Auto DevOps pipeline was disabled for #{project.name}")
      expect(rendered).to match(/Pipeline ##{pipeline.id} .* triggered by #{pipeline.user.name}/)
      expect(rendered).to have_content("Stage: #{build.stage_name}")
      expect(rendered).to have_content("Name: #{build.name}")
      expect(rendered).not_to have_content("Trace:")
    end
  end
end