diff options
Diffstat (limited to 'spec/helpers/emails_helper_spec.rb')
-rw-r--r-- | spec/helpers/emails_helper_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/helpers/emails_helper_spec.rb b/spec/helpers/emails_helper_spec.rb index 4af81cf83ac..96ac4015c77 100644 --- a/spec/helpers/emails_helper_spec.rb +++ b/spec/helpers/emails_helper_spec.rb @@ -118,6 +118,14 @@ RSpec.describe EmailsHelper do end end + describe '#say_hello' do + let(:user) { build(:user, name: 'John') } + + it 'returns the greeting message for the given user' do + expect(say_hello(user)).to eq('Hello, John!') + end + end + describe '#two_factor_authentication_disabled_text' do it 'returns the message that 2FA is disabled' do expect(two_factor_authentication_disabled_text).to eq( @@ -145,6 +153,33 @@ RSpec.describe EmailsHelper do end end + describe '#admin_changed_password_text' do + context 'format is html' do + it 'returns HTML' do + expect(admin_changed_password_text(format: :html)).to eq( + "An administrator changed the password for your GitLab account on " \ + "#{link_to(Gitlab.config.gitlab.url, Gitlab.config.gitlab.url, target: :_blank, rel: 'noopener noreferrer')}." + ) + end + end + + context 'format is not specified' do + it 'returns text' do + expect(admin_changed_password_text).to eq( + "An administrator changed the password for your GitLab account on #{Gitlab.config.gitlab.url}." + ) + end + end + end + + describe '#contact_your_administrator_text' do + it 'returns the message to contact the administrator' do + expect(contact_your_administrator_text).to eq( + _('Please contact your administrator with any questions.') + ) + end + end + describe 'password_reset_token_valid_time' do def validate_time_string(time_limit, expected_string) Devise.reset_password_within = time_limit |