2015-09-02 02:28:48 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Projects::RawController do
|
2018-08-30 08:34:41 -04:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
|
|
|
|
describe 'GET #show' do
|
|
|
|
subject do
|
|
|
|
get(:show,
|
2018-12-17 17:52:17 -05:00
|
|
|
params: {
|
|
|
|
namespace_id: project.namespace,
|
|
|
|
project_id: project,
|
|
|
|
id: filepath
|
|
|
|
})
|
2018-08-30 08:34:41 -04:00
|
|
|
end
|
2015-09-02 02:28:48 -04:00
|
|
|
|
|
|
|
context 'regular filename' do
|
2018-08-30 08:34:41 -04:00
|
|
|
let(:filepath) { 'master/README.md' }
|
2015-09-02 02:28:48 -04:00
|
|
|
|
2018-12-19 06:51:07 -05:00
|
|
|
it 'delivers ASCII file' do
|
|
|
|
subject
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
|
|
expect(response.header['Content-Type']).to eq('text/plain; charset=utf-8')
|
|
|
|
expect(response.header['Content-Disposition']).to eq('inline')
|
|
|
|
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
|
|
|
|
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:')
|
2015-09-02 02:28:48 -04:00
|
|
|
end
|
|
|
|
end
|
2015-09-03 05:55:43 -04:00
|
|
|
|
|
|
|
context 'image header' do
|
2018-08-30 08:34:41 -04:00
|
|
|
let(:filepath) { 'master/files/images/6049019_460s.jpg' }
|
2015-09-03 05:55:43 -04:00
|
|
|
|
2018-12-19 06:51:07 -05:00
|
|
|
it 'leaves image content disposition' do
|
|
|
|
subject
|
2015-09-03 05:55:43 -04:00
|
|
|
|
2018-12-19 06:51:07 -05:00
|
|
|
expect(response).to have_gitlab_http_status(200)
|
|
|
|
expect(response.header['Content-Disposition']).to eq('inline')
|
|
|
|
expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true"
|
|
|
|
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with('git-blob:')
|
2015-09-03 05:55:43 -04:00
|
|
|
end
|
|
|
|
end
|
2015-12-07 09:03:50 -05:00
|
|
|
|
2018-08-30 08:34:41 -04:00
|
|
|
it_behaves_like 'repository lfs file load' do
|
|
|
|
let(:filename) { 'lfs_object.iso' }
|
|
|
|
let(:filepath) { "be93687/files/lfs/#{filename}" }
|
2015-12-07 09:03:50 -05:00
|
|
|
end
|
2015-09-02 02:28:48 -04:00
|
|
|
end
|
|
|
|
end
|