Updated

spec/requests / login_timeout_spec.rb

B
41 lines of codes
0 methods
N/A complexity/method
3 churn
49.29 complexity
16 duplications
require 'rails_helper' RSpec.describe "login timeout", type: :request, csrf: false do let(:user_attributes) do { first_name: "System", last_name: "Administrator", email: "admin@petition.parliament.uk", password: "L3tme1n!", password_confirmation: "L3tme1n!" } end let(:login_params) do { email: "admin@petition.parliament.uk", password: "L3tme1n!" } end let!(:user) { FactoryBot.create(:sysadmin_user, user_attributes) } before do host! "moderate.petition.parliament.uk" https! end it "logs out automatically after a certain time period" do
  1. it#logs out automatically after a certain time period has a flog score of 43
Site.instance.update(login_timeout: 600) travel_to 2.minutes.ago do
  1. Similar code found in 2 nodes Locations: 0 1
post "/admin/user_sessions", admin_user_session: login_params expect(response).to redirect_to("/admin") end get "/admin" expect(response).to be_successful travel_to 15.minutes.from_now do get "/admin" expect(response).to redirect_to("/admin/login") end end end