From ea5b462a1408f9fcd77dfd2961049057fc8ccad9 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 8 Dec 2015 13:33:12 +0100 Subject: [PATCH] Stub the calls to disk and check what send_file returns. --- spec/controllers/projects/raw_controller_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb index cd42a592759..42c6d4f3f88 100644 --- a/spec/controllers/projects/raw_controller_spec.rb +++ b/spec/controllers/projects/raw_controller_spec.rb @@ -41,16 +41,18 @@ describe Projects::RawController do context 'when project has access' do before do public_project.lfs_objects << lfs_object + allow_any_instance_of(LfsObjectUploader).to receive(:exists?).and_return(true) + allow(controller).to receive(:send_file) { controller.render :nothing => true } end it 'serves the file' do + expect(controller).to receive(:send_file).with("#{Gitlab.config.shared.path}/lfs-objects/91/ef/f75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897", :filename => "lfs_object.iso", :disposition => 'attachment') get(:show, namespace_id: public_project.namespace.to_param, project_id: public_project.to_param, id: id) expect(response.status).to eq(200) - expect(response.header['Content-Type']).to eq('application/octet-stream') end end -- GitLab