aboutsummaryrefslogtreecommitdiffstats
path: root/spec/services
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/retry_service_spec.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/services/retry_service_spec.rb b/spec/services/retry_service_spec.rb
index 93788c9ae..0ab9ddef9 100644
--- a/spec/services/retry_service_spec.rb
+++ b/spec/services/retry_service_spec.rb
@@ -67,12 +67,17 @@ RSpec.describe RetryService do
@failures = 0
@count = 0
expect( subject ).to receive(:sleep).with(2)
- subject.register_failure_callback { @failures += 1 }
+ subject.register_failure_callback { |reason, count| @reason=reason; @callback_count=count; @failures += 1 }
end
it 'succeeds the second time and calls the failure_callback once' do
subject.execute{ succeed_later(RetryService::Retry){ 42 } }
expect( @failures ).to eq(1)
end
+ it '... and the failure is passed into the callback' do
+ subject.execute{ succeed_later(RetryService::Retry){ 42 } }
+ expect( @reason ).to be_a(RetryService::Retry)
+ expect( @callback_count ).to eq(1)
+ end
end
context 'failure callback twice' do