BUGFIX: regresses correct job execution

This commit is contained in:
Sam Saffron 2014-02-21 16:05:19 +11:00
parent 9a3af8997b
commit 451598c511
2 changed files with 15 additions and 1 deletions

View File

@ -138,7 +138,7 @@ module Jobs
end
t.join
exceptions << thread_exception
exceptions << thread_exception if thread_exception
end
end

View File

@ -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