mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 11:13:22 +08:00
BUGFIX: regresses correct job execution
This commit is contained in:
parent
9a3af8997b
commit
451598c511
|
@ -138,7 +138,7 @@ module Jobs
|
|||
end
|
||||
t.join
|
||||
|
||||
exceptions << thread_exception
|
||||
exceptions << thread_exception if thread_exception
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,6 +2,14 @@ require 'spec_helper'
|
|||
require_dependency 'jobs/base'
|
||||
|
||||
describe Jobs::Base do
|
||||
class GoodJob < Jobs::Base
|
||||
attr_accessor :count
|
||||
def execute(args)
|
||||
self.count ||= 0
|
||||
self.count += 1
|
||||
end
|
||||
end
|
||||
|
||||
class BadJob < Jobs::Base
|
||||
attr_accessor :fail_count
|
||||
|
||||
|
@ -12,6 +20,12 @@ describe Jobs::Base do
|
|||
end
|
||||
end
|
||||
|
||||
it 'handles correct jobs' do
|
||||
job = GoodJob.new
|
||||
job.perform({})
|
||||
job.count.should == 1
|
||||
end
|
||||
|
||||
it 'handles errors in multisite' do
|
||||
RailsMultisite::ConnectionManagement.expects(:all_dbs).returns(['default','default'])
|
||||
# just stub so logs are not noisy
|
||||
|
|
Loading…
Reference in New Issue
Block a user