diff options
Diffstat (limited to 'spec/helpers/sessions_helper_spec.rb')
-rw-r--r-- | spec/helpers/sessions_helper_spec.rb | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/spec/helpers/sessions_helper_spec.rb b/spec/helpers/sessions_helper_spec.rb index c7b8225b866..b8290fa2337 100644 --- a/spec/helpers/sessions_helper_spec.rb +++ b/spec/helpers/sessions_helper_spec.rb @@ -52,7 +52,7 @@ RSpec.describe SessionsHelper do end describe '#send_rate_limited?' do - let_it_be(:user) { build(:user) } + let(:user) { build_stubbed(:user) } subject { helper.send_rate_limited?(user) } @@ -77,30 +77,14 @@ RSpec.describe SessionsHelper do end describe '#obfuscated_email' do - subject { helper.obfuscated_email(email) } - - context 'when an email address is normal length' do - let(:email) { 'alex@gitlab.com' } - - it { is_expected.to eq('al**@g*****.com') } - end - - context 'when an email address contains multiple top level domains' do - let(:email) { 'alex@gl.co.uk' } + let(:email) { 'mail@example.com' } - it { is_expected.to eq('al**@g****.uk') } - end - - context 'when an email address is very short' do - let(:email) { 'a@b.c' } - - it { is_expected.to eq('a@b.c') } - end + subject { helper.obfuscated_email(email) } - context 'when an email address is even shorter' do - let(:email) { 'a@b' } + it 'delegates to Gitlab::Utils::Email.obfuscated_email' do + expect(Gitlab::Utils::Email).to receive(:obfuscated_email).with(email).and_call_original - it { is_expected.to eq('a@b') } + expect(subject).to eq('ma**@e******.com') end end end |