login_activities_controller_spec.rb 752 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Settings::LoginActivitiesController do
  4. render_views
  5. let!(:user) { Fabricate(:user) }
  6. let!(:login_activity) { Fabricate :login_activity, user: user }
  7. before do
  8. sign_in user, scope: :user
  9. end
  10. describe 'GET #index' do
  11. before do
  12. get :index
  13. end
  14. it 'returns http success with private cache control headers', :aggregate_failures do
  15. expect(response).to have_http_status(200)
  16. expect(response.headers['Cache-Control']).to include('private, no-store')
  17. expect(response.body)
  18. .to include(login_activity.user_agent)
  19. .and include(login_activity.authentication_method)
  20. .and include(login_activity.ip.to_s)
  21. end
  22. end
  23. end