Added reset of UserInfo.current_user_id for background jobs and transactions.

This commit is contained in:
Martin Edenhofer 2016-04-26 11:30:46 +02:00
parent c3743682ec
commit b9c24748a9
15 changed files with 110 additions and 177 deletions

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
# rubocop:disable Rails/Output
class Scheduler < ApplicationModel class Scheduler < ApplicationModel
# rubocop:disable Style/ClassVars # rubocop:disable Style/ClassVars
@ -114,9 +114,25 @@ class Scheduler < ApplicationModel
end end
end end
def self.worker def self.worker(foreground = false)
wait = 8
# used for tests
if foreground
original_user_id = UserInfo.current_user_id
UserInfo.current_user_id = nil
loop do
success, failure = Delayed::Worker.new.work_off
if failure != 0
raise "ERROR: #{failure} failed background jobs: #{Delayed::Job.where('last_error IS NOT NULL').inspect}"
end
break if success == 0
end
UserInfo.current_user_id = original_user_id
return
end
# used for production
wait = 8
Thread.new { Thread.new {
sleep wait sleep wait
@ -126,6 +142,7 @@ class Scheduler < ApplicationModel
result = nil result = nil
realtime = Benchmark.realtime do realtime = Benchmark.realtime do
logger.debug "*** worker thread, #{Delayed::Job.all.count} in queue"
result = Delayed::Worker.new.work_off result = Delayed::Worker.new.work_off
end end
@ -145,28 +162,4 @@ class Scheduler < ApplicationModel
end end
def self.check(name, time_warning = 10, time_critical = 20)
time_warning_time = Time.zone.now - time_warning.minutes
time_critical_time = Time.zone.now - time_critical.minutes
scheduler = Scheduler.find_by( name: name )
if !scheduler
puts "CRITICAL - no such scheduler jobs '#{name}'"
return true
end
logger.debug scheduler.inspect
if !scheduler.last_run
puts "CRITICAL - scheduler jobs never started '#{name}'"
exit 2
end
if scheduler.last_run < time_critical_time
puts "CRITICAL - scheduler jobs was not running in last '#{time_critical}' minutes - last run at '#{scheduler.last_run}' '#{name}'"
exit 2
end
if scheduler.last_run < time_warning_time
puts "CRITICAL - scheduler jobs was not running in last '#{time_warning}' minutes - last run at '#{scheduler.last_run}' '#{name}'"
exit 2
end
puts "ok - scheduler jobs was running at '#{scheduler.last_run}' '#{name}'"
exit 0
end
end end

View file

@ -24,12 +24,12 @@ class Transaction::BackgroundJob
Setting.where(area: 'Transaction::Backend').order(:name).each {|setting| Setting.where(area: 'Transaction::Backend').order(:name).each {|setting|
backend = Setting.get(setting.name) backend = Setting.get(setting.name)
begin begin
UserInfo.current_user_id = 1 UserInfo.current_user_id = nil
integration = Kernel.const_get(backend).new(@item, @params) integration = Kernel.const_get(backend).new(@item, @params)
integration.perform integration.perform
rescue => e rescue => e
logger.error 'ERROR: ' + setting.inspect Rails.logger.error 'ERROR: ' + setting.inspect
logger.error 'ERROR: ' + e.inspect Rails.logger.error 'ERROR: ' + e.inspect
end end
} }
end end

View file

@ -47,6 +47,7 @@ class Transaction::ClearbitEnrichment
end end
def self.sync_user(user) def self.sync_user(user)
UserInfo.current_user_id = 1
return if user.email.empty? return if user.email.empty?
data = fetch(user.email) data = fetch(user.email)

View file

@ -177,9 +177,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
system('rake searchindex:rebuild') system('rake searchindex:rebuild')
# execute background jobs # execute background jobs
# execute background jobs Scheduler.worker(true)
#puts Delayed::Job.all.inspect
Delayed::Worker.new.work_off
sleep 6 sleep 6
end end

View file

@ -48,7 +48,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert(customer1) assert(customer1)
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer1.id)) assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer1.id))
@ -76,7 +76,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert(customer2) assert(customer2)
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer2.id)) assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer2.id))
@ -99,7 +99,7 @@ class ClearbitTest < ActiveSupport::TestCase
) )
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer2.id)) assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer2.id))
@ -111,7 +111,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert_equal('Norsk-Data-Straße 1, 61352 Bad Homburg vor der Höhe, Germany', customer2_lookup.address) assert_equal('Norsk-Data-Straße 1, 61352 Bad Homburg vor der Höhe, Germany', customer2_lookup.address)
Transaction::ClearbitEnrichment.sync_user(customer2) Transaction::ClearbitEnrichment.sync_user(customer2)
Delayed::Worker.new.work_off Scheduler.worker(true)
customer2_lookup = User.lookup(id: customer2.id) customer2_lookup = User.lookup(id: customer2.id)
@ -127,7 +127,7 @@ class ClearbitTest < ActiveSupport::TestCase
) )
Transaction::ClearbitEnrichment.sync_user(customer2) Transaction::ClearbitEnrichment.sync_user(customer2)
Delayed::Worker.new.work_off Scheduler.worker(true)
customer2_lookup = User.lookup(id: customer2.id) customer2_lookup = User.lookup(id: customer2.id)
@ -142,7 +142,7 @@ class ClearbitTest < ActiveSupport::TestCase
) )
Transaction::ClearbitEnrichment.sync_user(customer2) Transaction::ClearbitEnrichment.sync_user(customer2)
Delayed::Worker.new.work_off Scheduler.worker(true)
customer2_lookup = User.lookup(id: customer2.id) customer2_lookup = User.lookup(id: customer2.id)
@ -168,7 +168,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert(customer3) assert(customer3)
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
assert_not(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer3.id)) assert_not(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer3.id))
@ -199,7 +199,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert(customer4) assert(customer4)
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer4.id)) assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer4.id))
@ -228,7 +228,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert(customer5) assert(customer5)
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer5.id)) assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer5.id))
@ -259,7 +259,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert(customer6) assert(customer6)
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
assert_not(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer6.id)) assert_not(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer6.id))
@ -322,7 +322,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert(customer1) assert(customer1)
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer1.id)) assert(ExternalSync.find_by(source: 'clearbit', object: 'User', o_id: customer1.id))

View file

@ -215,8 +215,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
) )
# execute background jobs # execute background jobs
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
sleep 6 sleep 6

View file

@ -240,8 +240,7 @@ class ReportTest < ActiveSupport::TestCase
) )
# execute background jobs # execute background jobs
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
sleep 6 sleep 6

View file

@ -69,7 +69,7 @@ class SlackTest < ActiveSupport::TestCase
) )
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(0, slack_check(channel, hash)) assert_equal(0, slack_check(channel, hash))
@ -78,7 +78,7 @@ class SlackTest < ActiveSupport::TestCase
ticket1.save ticket1.save
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(0, slack_check(channel, hash)) assert_equal(0, slack_check(channel, hash))
@ -107,7 +107,7 @@ class SlackTest < ActiveSupport::TestCase
) )
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(1, slack_check(channel, hash)) assert_equal(1, slack_check(channel, hash))
@ -119,7 +119,7 @@ class SlackTest < ActiveSupport::TestCase
ticket2.save ticket2.save
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(1, slack_check(channel, hash)) assert_equal(1, slack_check(channel, hash))
@ -129,7 +129,7 @@ class SlackTest < ActiveSupport::TestCase
ticket2.save ticket2.save
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(2, slack_check(channel, hash)) assert_equal(2, slack_check(channel, hash))
@ -137,7 +137,7 @@ class SlackTest < ActiveSupport::TestCase
Ticket.process_pending Ticket.process_pending
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(3, slack_check(channel, hash)) assert_equal(3, slack_check(channel, hash))
@ -145,7 +145,7 @@ class SlackTest < ActiveSupport::TestCase
Ticket.process_pending Ticket.process_pending
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(3, slack_check(channel, hash)) assert_equal(3, slack_check(channel, hash))
@ -188,7 +188,7 @@ class SlackTest < ActiveSupport::TestCase
) )
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(0, slack_check(channel, hash)) assert_equal(0, slack_check(channel, hash))
@ -197,7 +197,7 @@ class SlackTest < ActiveSupport::TestCase
ticket3.save ticket3.save
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(0, slack_check(channel, hash)) assert_equal(0, slack_check(channel, hash))
@ -226,7 +226,7 @@ class SlackTest < ActiveSupport::TestCase
) )
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(1, slack_check(channel, hash)) assert_equal(1, slack_check(channel, hash))
@ -238,7 +238,7 @@ class SlackTest < ActiveSupport::TestCase
ticket4.save ticket4.save
Observer::Transaction.commit Observer::Transaction.commit
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if message exists # check if message exists
assert_equal(0, slack_check(channel, hash)) assert_equal(0, slack_check(channel, hash))

View file

@ -18,6 +18,9 @@ class ActiveSupport::TestCase
# clear cache # clear cache
Cache.clear Cache.clear
# remove background jobs
Delayed::Job.destroy_all
# set current user # set current user
UserInfo.current_user_id = nil UserInfo.current_user_id = nil
end end

View file

@ -24,9 +24,6 @@ class ActiveSupport::TestCase
load "#{Rails.root}/db/seeds.rb" load "#{Rails.root}/db/seeds.rb"
load "#{Rails.root}/test/fixtures/seeds.rb" load "#{Rails.root}/test/fixtures/seeds.rb"
# proccess background jobs
Delayed::Worker.new.work_off
# set system mode to done / to activate # set system mode to done / to activate
Setting.set('system_init_done', true) Setting.set('system_init_done', true)
@ -35,21 +32,12 @@ class ActiveSupport::TestCase
# clear cache # clear cache
Cache.clear Cache.clear
# remove background jobs
Delayed::Job.destroy_all
# set current user # set current user
UserInfo.current_user_id = nil UserInfo.current_user_id = nil
end end
# cleanup jobs
def teardown
# check if jobs are proccessed
return if Delayed::Job.all.empty?
Delayed::Job.where('failed_at != NULL').each {|job|
assert( false, "not processable job #{job.inspect}" )
}
Delayed::Job.all.destroy_all
end
# Add more helper methods to be used by all tests here... # Add more helper methods to be used by all tests here...
end end

View file

@ -73,7 +73,7 @@ class EmailSignaturDetectionTest < ActiveSupport::TestCase
ticket1, article1, user1, mail = Channel::EmailParser.new.process({}, raw_email) ticket1, article1, user1, mail = Channel::EmailParser.new.process({}, raw_email)
assert(ticket1) assert(ticket1)
assert(article1) assert(article1)
Delayed::Worker.new.work_off Scheduler.worker(true)
# process email II # process email II
file = File.open("#{Rails.root}/test/fixtures/email_signature_detection/client_a_2.txt", 'rb') file = File.open("#{Rails.root}/test/fixtures/email_signature_detection/client_a_2.txt", 'rb')
@ -81,7 +81,7 @@ class EmailSignaturDetectionTest < ActiveSupport::TestCase
ticket2, article2, user2, mail = Channel::EmailParser.new.process({}, raw_email) ticket2, article2, user2, mail = Channel::EmailParser.new.process({}, raw_email)
assert(ticket2) assert(ticket2)
assert(article2) assert(article2)
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if user2 has a signature_detection value # check if user2 has a signature_detection value
user2 = User.find(user2.id) user2 = User.find(user2.id)
@ -93,7 +93,7 @@ class EmailSignaturDetectionTest < ActiveSupport::TestCase
ticket3, article3, user3, mail = Channel::EmailParser.new.process({}, raw_email) ticket3, article3, user3, mail = Channel::EmailParser.new.process({}, raw_email)
assert(ticket3) assert(ticket3)
assert(article3) assert(article3)
Delayed::Worker.new.work_off Scheduler.worker(true)
# check if article3 has a signature_detection value # check if article3 has a signature_detection value
article3 = Ticket::Article.find(article3.id) article3 = Ticket::Article.find(article3.id)

View file

@ -175,7 +175,7 @@ class HistoryTest < ActiveSupport::TestCase
Observer::Transaction.commit Observer::Transaction.commit
# execute background jobs # execute background jobs
Delayed::Worker.new.work_off Scheduler.worker(true)
# remember ticket # remember ticket
tickets.push ticket tickets.push ticket

View file

@ -62,8 +62,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already closed # because it's already closed
assert(OnlineNotification.all_seen?('Ticket', ticket1.id)) assert(OnlineNotification.all_seen?('Ticket', ticket1.id))
@ -81,8 +80,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already open # because it's already open
assert(!OnlineNotification.all_seen?('Ticket', ticket1.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket1.id))
@ -119,8 +117,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already closed # because it's already closed
assert(!OnlineNotification.all_seen?('Ticket', ticket2.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket2.id))
@ -138,8 +135,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already open # because it's already open
assert(!OnlineNotification.all_seen?('Ticket', ticket2.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket2.id))
@ -175,8 +171,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already new # because it's already new
assert(!OnlineNotification.all_seen?('Ticket', ticket3.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket3.id))
@ -194,8 +189,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already closed # because it's already closed
assert(OnlineNotification.all_seen?('Ticket', ticket3.id)) assert(OnlineNotification.all_seen?('Ticket', ticket3.id))
@ -219,8 +213,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already closed but an follow up arrived later # because it's already closed but an follow up arrived later
assert(!OnlineNotification.all_seen?('Ticket', ticket3.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket3.id))
@ -258,8 +251,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already new # because it's already new
assert(!OnlineNotification.all_seen?('Ticket', ticket4.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket4.id))
@ -277,8 +269,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already open # because it's already open
assert(!OnlineNotification.all_seen?('Ticket', ticket4.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket4.id))
@ -314,8 +305,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already new # because it's already new
assert(!OnlineNotification.all_seen?('Ticket', ticket5.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket5.id))
@ -333,8 +323,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# because it's already open # because it's already open
assert(!OnlineNotification.all_seen?('Ticket', ticket5.id)) assert(!OnlineNotification.all_seen?('Ticket', ticket5.id))
@ -348,7 +337,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
ticket_id: tickets[1].id, ticket_id: tickets[1].id,
user_id: 1, user_id: 1,
) )
Delayed::Worker.new.work_off Scheduler.worker(true)
notifications = OnlineNotification.list_by_object('Ticket', tickets[0].id) notifications = OnlineNotification.list_by_object('Ticket', tickets[0].id)
assert(!notifications.empty?, 'should have notifications') assert(!notifications.empty?, 'should have notifications')
@ -366,7 +355,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 Scheduler.worker(true)
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')
} }

View file

@ -88,8 +88,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Rails.configuration.webserver_is_active = nil Rails.configuration.webserver_is_active = nil
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -123,8 +122,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Rails.configuration.webserver_is_active = true Rails.configuration.webserver_is_active = true
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -161,8 +159,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Rails.configuration.webserver_is_active = true Rails.configuration.webserver_is_active = true
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -175,8 +172,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -197,8 +193,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to not to agent1 but to agent2 # verify notifications to not to agent1 but to agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -222,8 +217,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to not to agent1 but to agent2 # verify notifications to not to agent1 but to agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -256,8 +250,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
assert(ticket2, 'ticket created') assert(ticket2, 'ticket created')
# verify notifications to no one # verify notifications to no one
@ -272,8 +265,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to no one # verify notifications to no one
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket2, agent1, 'email'), ticket2.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket2, agent1, 'email'), ticket2.id)
@ -287,8 +279,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 and not to agent2 # verify notifications to agent1 and not to agent2
assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket2, agent1, 'email'), ticket2.id) assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket2, agent1, 'email'), ticket2.id)
@ -321,8 +312,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
assert(ticket3, 'ticket created') assert(ticket3, 'ticket created')
# verify notifications to agent1 and not to agent2 # verify notifications to agent1 and not to agent2
@ -337,8 +327,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to no one # verify notifications to no one
assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id) assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id)
@ -352,8 +341,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 and not to agent2 # verify notifications to agent1 and not to agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id)
@ -365,8 +353,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications not to agent1 and not to agent2 # verify notifications not to agent1 and not to agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id)
@ -412,7 +399,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit(disable_notification: true) Observer::Transaction.commit(disable_notification: true)
Delayed::Worker.new.work_off Scheduler.worker(true)
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -465,8 +452,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Rails.configuration.webserver_is_active = false Rails.configuration.webserver_is_active = false
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -479,8 +465,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, agent1, 'email'), ticket1.id)
@ -513,8 +498,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket2, agent1, 'email'), ticket2.id) assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket2, agent1, 'email'), ticket2.id)
@ -527,8 +511,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket2, agent1, 'email'), ticket2.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket2, agent1, 'email'), ticket2.id)
@ -561,8 +544,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id)
@ -575,8 +557,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket3, agent1, 'email'), ticket3.id)
@ -627,8 +608,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Rails.configuration.webserver_is_active = false Rails.configuration.webserver_is_active = false
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket4, agent1, 'email'), ticket4.id) assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket4, agent1, 'email'), ticket4.id)
@ -641,8 +621,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket4, agent1, 'email'), ticket4.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket4, agent1, 'email'), ticket4.id)
@ -693,8 +672,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Rails.configuration.webserver_is_active = false Rails.configuration.webserver_is_active = false
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket5, agent1, 'email'), ticket5.id) assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket5, agent1, 'email'), ticket5.id)
@ -707,8 +685,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket5, agent1, 'email'), ticket5.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket5, agent1, 'email'), ticket5.id)
@ -760,8 +737,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Rails.configuration.webserver_is_active = false Rails.configuration.webserver_is_active = false
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket6, agent1, 'email'), ticket6.id) assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket6, agent1, 'email'), ticket6.id)
@ -776,8 +752,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket6, agent1, 'email'), ticket6.id) assert_equal(2, NotificationFactory::Mailer.already_sent?(ticket6, agent1, 'email'), ticket6.id)
@ -839,8 +814,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Rails.configuration.webserver_is_active = false Rails.configuration.webserver_is_active = false
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket7, agent1, 'email'), ticket7.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket7, agent1, 'email'), ticket7.id)
@ -855,8 +829,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
# execute object transaction # execute object transaction
Observer::Transaction.commit Observer::Transaction.commit
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
# verify notifications to agent1 + agent2 # verify notifications to agent1 + agent2
assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket7, agent1, 'email'), ticket7.id) assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket7, agent1, 'email'), ticket7.id)

View file

@ -74,8 +74,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
@ -92,8 +91,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
@ -155,8 +153,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 2' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 2' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 2' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 2' )
@ -601,8 +598,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
@ -691,8 +687,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
@ -730,8 +725,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 08:00:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 08:00:00 UTC', 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-10-21 08:00:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-10-21 08:00:00 UTC', 'ticket.first_response_escal_date verify 1' )
@ -885,8 +879,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
@ -982,8 +975,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 13:00:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 13:00:00 UTC', 'ticket.first_response_escal_date verify 1' )
@ -1110,8 +1102,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 12:30:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 12:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
@ -1254,8 +1245,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
#puts Delayed::Job.all.inspect Scheduler.worker(true)
Delayed::Worker.new.work_off
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 12:30:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 12:30:00 UTC', 'ticket.first_response_escal_date verify 1' )