Created
May 6, 2015 19:54
-
-
Save waldofe/50b1d63e41de0ac46505 to your computer and use it in GitHub Desktop.
Testing Job call on model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test | |
describe '#initialize_delayed_recharge_process' do | |
subject { create :transport_service_recharge_batch } | |
let(:calculation_job) do | |
instance_double(RH::TransportRechargeBatchCalculationJob) | |
end | |
it 'calls DelayedJob#enqueue on RH::TransportRechargeBatchCalculationJob' do | |
expect(RH::TransportRechargeBatchCalculationJob).to receive(:new). | |
with(id: subject.id).and_return(calculation_job) | |
expect(Delayed::Job).to receive(:enqueue).with(calculation_job) | |
subject.initialize_delayed_recharge_process | |
end | |
end | |
#model | |
def initialize_delayed_recharge_process | |
Delayed::Job.enqueue RH::TransportRechargeBatchCalculationJob.new(id: id) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment