mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:49:14 +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
|
||||
|
||||
|
@ -11,6 +19,12 @@ describe Jobs::Base do
|
|||
raise StandardError
|
||||
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'])
|
||||
|
|
Loading…
Reference in New Issue
Block a user