aboutsummaryrefslogtreecommitdiffstats
path: root/spec/workers
diff options
context:
space:
mode:
authorRobert2017-07-19 16:40:45 +0200
committerRobert2017-07-20 11:49:34 +0200
commita1368a9730e20b2e3a85885740e6fb7ffec435ad (patch)
tree0c8b5ad5b6da7d9813abb7feb16601afae8b8507 /spec/workers
parentfba2bbccba9670d8d786781e7ec82f06b7a7fddc (diff)
downloadchouette-core-a1368a9730e20b2e3a85885740e6fb7ffec435ad.tar.bz2
bup working on WorkbenchImportWorker's integration spec [amend me]
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/stop_area_referential_sync_worker_spec.rb1
-rw-r--r--spec/workers/workbench_import_worker_spec.rb25
2 files changed, 25 insertions, 1 deletions
diff --git a/spec/workers/stop_area_referential_sync_worker_spec.rb b/spec/workers/stop_area_referential_sync_worker_spec.rb
index 48b64e55e..50c7cf45f 100644
--- a/spec/workers/stop_area_referential_sync_worker_spec.rb
+++ b/spec/workers/stop_area_referential_sync_worker_spec.rb
@@ -1,4 +1,3 @@
-require 'rails_helper'
RSpec.describe StopAreaReferentialSyncWorker, type: :worker do
let!(:stop_area_referential_sync) { create :stop_area_referential_sync }
diff --git a/spec/workers/workbench_import_worker_spec.rb b/spec/workers/workbench_import_worker_spec.rb
new file mode 100644
index 000000000..bfe631fc4
--- /dev/null
+++ b/spec/workers/workbench_import_worker_spec.rb
@@ -0,0 +1,25 @@
+RSpec.describe WorkbenchImportWorker, type: [:worker, :request] do
+
+ let( :worker ) { described_class.new }
+ let( :import ){ build_stubbed :import }
+ let( :workbench ){ import.workbench }
+ let( :referential ){ import.referential }
+ let( :api_key ){ build_stubbed :api_key, referential: referential }
+
+ let( :path ){ download_workbench_import_path(workbench, import) }
+ let( :result ){ import.file.read }
+
+ before do
+ # That should be `build_stubbed's` job, no?
+ allow(Import).to receive(:find).with(import.id).and_return(import)
+ end
+ it 'downloads a zip file' do
+ # /workbenches/:workbench_id/imports/:id/download
+ stub_request(:get, path)
+ .with(headers: authorization_token_header(api_key))
+ .to_return(body: result)
+ # WTH was I trying to test ;) Ah yeah HTTP into download
+ worker.perform import.id
+ expect( worker.downloaded ).to eq( result )
+ end
+end