invalid_session_handling_spec.rb 746 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Mobile > Basic > Invalid session handling', app: :mobile, authenticated_as: false, type: :system do
  4. let(:group) { create(:group) }
  5. let(:agent) { create(:agent, :groupable, group: group) }
  6. let(:ticket) { create(:ticket, group: group) }
  7. it 'clears the authenticated flag when session check fails' do
  8. visit '/login'
  9. login(
  10. username: agent.login,
  11. password: 'test',
  12. )
  13. visit "/tickets/#{ticket.id}"
  14. expect_current_route "/tickets/#{ticket.id}"
  15. delete_cookie('^_zammad.+?')
  16. visit "/tickets/#{ticket.id}"
  17. expect_current_route "/login?redirect=/tickets/#{ticket.id}"
  18. end
  19. end