BUGFIX: regresses correct job execution
This commit is contained in:
parent
9a3af8997b
commit
451598c511
|
@ -138,7 +138,7 @@ module Jobs
|
||||||
end
|
end
|
||||||
t.join
|
t.join
|
||||||
|
|
||||||
exceptions << thread_exception
|
exceptions << thread_exception if thread_exception
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,14 @@ require 'spec_helper'
|
||||||
require_dependency 'jobs/base'
|
require_dependency 'jobs/base'
|
||||||
|
|
||||||
describe Jobs::Base do
|
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
|
class BadJob < Jobs::Base
|
||||||
attr_accessor :fail_count
|
attr_accessor :fail_count
|
||||||
|
|
||||||
|
@ -12,6 +20,12 @@ describe Jobs::Base do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'handles correct jobs' do
|
||||||
|
job = GoodJob.new
|
||||||
|
job.perform({})
|
||||||
|
job.count.should == 1
|
||||||
|
end
|
||||||
|
|
||||||
it 'handles errors in multisite' do
|
it 'handles errors in multisite' do
|
||||||
RailsMultisite::ConnectionManagement.expects(:all_dbs).returns(['default','default'])
|
RailsMultisite::ConnectionManagement.expects(:all_dbs).returns(['default','default'])
|
||||||
# just stub so logs are not noisy
|
# just stub so logs are not noisy
|
||||||
|
|
Loading…
Reference in New Issue