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

user_deactivated_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: 60379714ff2a0f8f9837c1e24351ee792c4c14c1 (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
39
40
41
42
43
44
45
46
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'notify/user_deactivated_email.text.erb', feature_category: :user_management do
  let(:name) { 'John Smith' }

  before do
    assign(:name, name)
  end

  it_behaves_like 'renders plain text email correctly'

  it "displays the user's name" do
    render

    expect(rendered).to have_content(/^Hello John Smith,/)
  end

  context 'when additional text setting is set' do
    before do
      allow(Gitlab::CurrentSettings).to receive(:deactivation_email_additional_text)
        .and_return('So long and thanks for all the fish!')
    end

    context 'when additional text feature flag is enabled' do
      it 'displays the additional text' do
        render

        expect(rendered).to have_content(/So long and thanks for all the fish!$/)
      end
    end
  end

  context 'when additional text setting is not set' do
    before do
      allow(Gitlab::CurrentSettings).to receive(:deactivation_email_additional_text).and_return('')
    end

    it 'does not display any additional text' do
      render

      expect(rendered).to have_content(/Please contact your GitLab administrator if you think this is an error\.$/)
    end
  end
end