aboutsummaryrefslogtreecommitdiffstats
path: root/spec/workers
diff options
context:
space:
mode:
authorTeddy Wing2017-09-05 13:22:11 +0200
committerTeddy Wing2017-09-05 13:22:11 +0200
commit1485d68a3bef38fa3ed61cf610855861cea405b7 (patch)
treeddf833bfba3e9ff2a522dcff24c6a6d8c078c761 /spec/workers
parentedbdd5a05fb9b75a6565c31f37d1ce8a501db265 (diff)
downloadchouette-core-1485d68a3bef38fa3ed61cf610855861cea405b7.tar.bz2
WorkbenchImportWorker spec: Catch `StopIteration` exception
The code was changed in 038710b22ccf3dd2421ec8d07fae45ef05a47ada, but the tests weren't changed to reflect this. In that change, the subdir enumeration is stopped if the `HTTPService` POST request fails with an error. This caused us to receive the following error when running the tests: 2) WorkbenchImportWorker multireferential zipfile with error downloads a zip file, cuts it, and uploads some pieces Failure/Error: expect { worker.perform import.id }.to raise_error( StopIteration, post_response_failure.body ) expected StopIteration with {:error=>"What was you thinking"}, got #<StopIteration: {:error=>"What was you thinking"}> with backtrace: # ./app/workers/workbench_import_worker.rb:63:in `upload_entry_group' # ./app/workers/workbench_import_worker.rb:38:in `each' # ./app/workers/workbench_import_worker.rb:38:in `each_with_index' # ./app/workers/workbench_import_worker.rb:38:in `upload' # ./app/workers/workbench_import_worker.rb:15:in `perform' # ./spec/workers/workbench_import_worker_spec.rb:105:in `block (4 levels) in <top (required)>' # ./spec/workers/workbench_import_worker_spec.rb:105:in `block (3 levels) in <top (required)>' # -e:1:in `<main>' # ./spec/workers/workbench_import_worker_spec.rb:105:in `block (3 levels) in <top (required)>' # -e:1:in `<main>' In order to get around this, just catch the error. Hopefully this is right.
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/workbench_import_worker_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/workers/workbench_import_worker_spec.rb b/spec/workers/workbench_import_worker_spec.rb
index 14c4239b7..79b9443e0 100644
--- a/spec/workers/workbench_import_worker_spec.rb
+++ b/spec/workers/workbench_import_worker_spec.rb
@@ -102,7 +102,7 @@ RSpec.describe WorkbenchImportWorker, type: [:worker, :request] do
expect( import ).to receive(:update).with(current_step: 2)
expect( import ).to receive(:update).with(current_step: 3, status: 'failed')
- worker.perform import.id
+ expect { worker.perform import.id }.to raise_error(StopIteration)
end
end