debian-mirror-gitlab/spec/views/notify/autodevops_disabled_email.text.erb_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

2020-11-24 15:15:51 +05:30
# 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
2023-06-20 00:43:36 +05:30
create(
:ci_pipeline,
:failed,
project: project,
user: user,
ref: project.default_branch,
sha: project.commit.sha
)
2020-11-24 15:15:51 +05:30
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}/)
2022-10-11 01:57:18 +05:30
expect(rendered).to have_content("Stage: #{build.stage_name}")
2020-11-24 15:15:51 +05:30
expect(rendered).to have_content("Name: #{build.name}")
expect(rendered).not_to have_content("Trace:")
end
end
end