diff options
| author | Robert | 2017-07-27 07:41:41 +0200 |
|---|---|---|
| committer | Robert | 2017-07-27 07:41:41 +0200 |
| commit | 96a6ae08191b465a91b285cf157223c0a898ed5d (patch) | |
| tree | aa45274f521b37fc3f5d12f03839f87273c4dbfb /spec | |
| parent | 9b97b8728a1d3714147591e4facacad097f2a155 (diff) | |
| download | chouette-core-96a6ae08191b465a91b285cf157223c0a898ed5d.tar.bz2 | |
Refs: #3507@0.25h; Added information to retry callbacks in RetryService (for logging)
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/services/retry_service_spec.rb | 7 |
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 |
