Drop not needed bg job after test file has finished.

This commit is contained in:
Martin Edenhofer 2015-05-02 00:58:43 +02:00
parent e8667a1a2d
commit b566a36797

View file

@ -24,10 +24,13 @@ class ActiveSupport::TestCase
# load seeds # load seeds
load "#{Rails.root}/db/seeds.rb" load "#{Rails.root}/db/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)
setup do def setup
# clear cache # clear cache
Cache.clear Cache.clear
@ -37,5 +40,15 @@ class ActiveSupport::TestCase
UserInfo.current_user_id = nil UserInfo.current_user_id = nil
end end
# cleanup jobs
def teardown
puts 'teardown'
# check if jobs are proccessed
if !Delayed::Job.all.empty?
Delayed::Job.all.destroy_all
end
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