diff options
Diffstat (limited to 'spec/models/authentication_event_spec.rb')
-rw-r--r-- | spec/models/authentication_event_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/authentication_event_spec.rb b/spec/models/authentication_event_spec.rb index 23e253c2a28..17fe10b5b4e 100644 --- a/spec/models/authentication_event_spec.rb +++ b/spec/models/authentication_event_spec.rb @@ -71,4 +71,19 @@ RSpec.describe AuthenticationEvent do it { is_expected.to eq(false) } end end + + describe '.most_used_ip_address_for_user' do + let_it_be(:user) { create(:user) } + let_it_be(:most_used_ip_address) { '::1' } + let_it_be(:another_ip_address) { '127.0.0.1' } + + subject { described_class.most_used_ip_address_for_user(user) } + + before do + create_list(:authentication_event, 2, user: user, ip_address: most_used_ip_address) + create(:authentication_event, user: user, ip_address: another_ip_address) + end + + it { is_expected.to eq(most_used_ip_address) } + end end |