user_device_log_job_spec.rb 603 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe UserDeviceLogJob, type: :job do
  4. let!(:user) { create(:user) }
  5. it 'executes user device log job' do
  6. expect do
  7. described_class.perform_now(
  8. 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36',
  9. '172.0.0.1',
  10. user.id,
  11. 'fingerprintABC123',
  12. 'session',
  13. )
  14. end.to change {
  15. UserDevice.where(
  16. user_id: user.id,
  17. ).count
  18. }.by(1)
  19. end
  20. end