diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2015-12-07 15:03:50 +0100 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2015-12-07 15:03:50 +0100 |
commit | e53b350cb6db7438c1a50c500b324fd87afc41c4 (patch) | |
tree | 61626047bbb7c248e1e245dc9dde291a9ae65b5a /spec/controllers | |
parent | b2c4675cb0e681027334e5bd046451d3116924c8 (diff) | |
download | gitlab-ce-e53b350cb6db7438c1a50c500b324fd87afc41c4.tar.gz |
Add specs for showing lfs object in UI.
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/raw_controller_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb index c114f342021..2329c246daa 100644 --- a/spec/controllers/projects/raw_controller_spec.rb +++ b/spec/controllers/projects/raw_controller_spec.rb @@ -33,5 +33,37 @@ describe Projects::RawController do expect(response.header['Content-Type']).to eq('image/jpeg') end end + + context 'lfs object' do + let(:id) { 'master/files/lfs/lfs_object.iso' } + let!(:lfs_object) { create(:lfs_object, oid: '91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897', size: '1575078') } + + context 'when project has access' do + before do + public_project.lfs_objects << lfs_object + end + + it 'serves the file' do + 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 + + context 'when project does not have access' do + it 'does not serve the file' do + get(:show, + namespace_id: public_project.namespace.to_param, + project_id: public_project.to_param, + id: id) + + expect(response.status).to eq(404) + end + end + end end end |