Fixed reset of online notifications.

This commit is contained in:
Martin Edenhofer 2015-05-01 17:06:19 +02:00
parent e4896fbb7e
commit ac9a5b1164
2 changed files with 3 additions and 1 deletions

View file

@ -23,6 +23,6 @@ class Observer::Ticket::OnlineNotificationSeen < ActiveRecord::Observer
# set all online notifications to seen # set all online notifications to seen
# send background job # send background job
Delayed::Job.enqueue( Observer::Ticket::UserTicketCounter::BackgroundJob.new( record.id ) ) Delayed::Job.enqueue( Observer::Ticket::OnlineNotificationSeen::BackgroundJob.new( record.id ) )
end end
end end

View file

@ -299,6 +299,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
ticket_id: tickets[3].id, ticket_id: tickets[3].id,
user_id: 1, user_id: 1,
) )
Delayed::Worker.new.work_off
notifications = OnlineNotification.list_by_object( 'Ticket', tickets[2].id ) notifications = OnlineNotification.list_by_object( 'Ticket', tickets[2].id )
assert( !notifications.empty?, 'should have notifications') assert( !notifications.empty?, 'should have notifications')
assert( notification_seen_only_exists_exists(notifications), 'still not seen notifications for merged ticket available') assert( notification_seen_only_exists_exists(notifications), 'still not seen notifications for merged ticket available')
@ -315,6 +316,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert( !found, 'Ticket destroyed') assert( !found, 'Ticket destroyed')
# check if notifications for ticket still exist # check if notifications for ticket still exist
Delayed::Worker.new.work_off
notifications = OnlineNotification.list_by_object( 'Ticket', ticket_id ) notifications = OnlineNotification.list_by_object( 'Ticket', ticket_id )
assert( notifications.empty?, 'still notifications for destroyed ticket available') assert( notifications.empty?, 'still notifications for destroyed ticket available')
} }