ticket_online_notification_seen_job_spec.rb 723 B

1234567891011121314151617181920212223
  1. require 'rails_helper'
  2. RSpec.describe TicketOnlineNotificationSeenJob, type: :job do
  3. let!(:user) { create(:user) }
  4. let!(:other_user) { create(:user) }
  5. let!(:ticket) { create(:ticket, owner: user, created_by_id: user.id) }
  6. let!(:online_notification) do
  7. create(:online_notification, o_id: ticket.id, user_id: user.id)
  8. end
  9. it 'checks if online notification has not been seen' do
  10. expect(online_notification.reload.seen).to be false
  11. end
  12. it 'checks if online notification has been seen' do
  13. ticket.state_id = Ticket::State.lookup(name: 'closed').id
  14. ticket.save!
  15. expect do
  16. described_class.perform_now(ticket.id, user.id)
  17. end.to change { online_notification.reload.seen }
  18. end
  19. end