user_device_log_job_spec.rb 526 B

12345678910111213141516171819202122
  1. require 'rails_helper'
  2. RSpec.describe UserDeviceLogJob, type: :job do
  3. let!(:user) { create(:user) }
  4. it 'executes user device log job' do
  5. expect do
  6. described_class.perform_now(
  7. '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',
  8. '172.0.0.1',
  9. user.id,
  10. 'fingerprintABC123',
  11. 'session',
  12. )
  13. end.to change {
  14. UserDevice.where(
  15. user_id: user.id,
  16. ).count
  17. }.by(1)
  18. end
  19. end