diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-08 18:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-08 18:08:59 +0300 |
commit | c6c5dd8848b78528d7ad7f044a0c95be629d372e (patch) | |
tree | 261577e229ade85472353eb5b380c1e4fed9bc60 /spec/views | |
parent | d0aeb5df3d6b06165355b023a25b79c7bd74a27d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/notify/user_deactivated_email.html.haml_spec.rb | 56 | ||||
-rw-r--r-- | spec/views/notify/user_deactivated_email.text.erb_spec.rb | 58 |
2 files changed, 114 insertions, 0 deletions
diff --git a/spec/views/notify/user_deactivated_email.html.haml_spec.rb b/spec/views/notify/user_deactivated_email.html.haml_spec.rb new file mode 100644 index 00000000000..25d18e37cb9 --- /dev/null +++ b/spec/views/notify/user_deactivated_email.html.haml_spec.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'notify/user_deactivated_email.html.haml', feature_category: :user_management do + let(:name) { 'John Smith' } + + before do + assign(:name, name) + end + + 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 + + context 'when additional text feature flag is disabled' do + before do + stub_feature_flags(deactivation_email_additional_text: false) + end + + it 'does not display the additional text' do + render + + expect(rendered).to have_content(/Please contact your GitLab administrator if you think this is an error\.$/) + 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 diff --git a/spec/views/notify/user_deactivated_email.text.erb_spec.rb b/spec/views/notify/user_deactivated_email.text.erb_spec.rb new file mode 100644 index 00000000000..8cf56816b92 --- /dev/null +++ b/spec/views/notify/user_deactivated_email.text.erb_spec.rb @@ -0,0 +1,58 @@ +# 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 + + context 'when additional text feature flag is disabled' do + before do + stub_feature_flags(deactivation_email_additional_text: false) + end + + it 'does not display the additional text' do + render + + expect(rendered).to have_content(/Please contact your GitLab administrator if you think this is an error\.$/) + 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 |