Convert settings/login_activities
controller spec to system spec (#33306)
This commit is contained in:
parent
3d00b95359
commit
a596f3479b
2 changed files with 34 additions and 29 deletions
34
spec/system/settings/login_activities_spec.rb
Normal file
34
spec/system/settings/login_activities_spec.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Login activities page' do
|
||||
let!(:user) { Fabricate :user }
|
||||
let!(:login_activity) { Fabricate :login_activity, user: user }
|
||||
|
||||
context 'when signed in' do
|
||||
before { sign_in user }
|
||||
|
||||
describe 'Viewing the login activities page' do
|
||||
it 'shows the login activity history' do
|
||||
visit edit_user_registration_path
|
||||
|
||||
click_on I18n.t('sessions.view_authentication_history')
|
||||
|
||||
expect(page)
|
||||
.to have_content(browser_description)
|
||||
.and have_content(login_activity.authentication_method)
|
||||
.and have_content(login_activity.ip)
|
||||
.and have_private_cache_control
|
||||
end
|
||||
|
||||
def browser_description
|
||||
I18n.t(
|
||||
'sessions.description',
|
||||
browser: I18n.t("sessions.browsers.#{login_activity.browser}", default: login_activity.browser),
|
||||
platform: I18n.t("sessions.platforms.#{login_activity.platform}", default: login_activity.platform)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue