4144c59941
Add Content-Type header to fix a bug which IE can't show image in markdown when the image is from raw. modified: CHANGELOG modified: app/controllers/projects/raw_controller.rb modified: spec/controllers/projects/raw_controller_spec.rb
37 lines
1 KiB
Ruby
37 lines
1 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe Projects::RawController do
|
|
let(:public_project) { create(:project, :public) }
|
|
|
|
describe "#show" do
|
|
context 'regular filename' do
|
|
let(:id) { 'master/README.md' }
|
|
|
|
it 'delivers ASCII 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('text/plain; charset=utf-8')
|
|
expect(response.header['Content-Disposition']).
|
|
to eq("inline")
|
|
end
|
|
end
|
|
|
|
context 'image header' do
|
|
let(:id) { 'master/files/images/6049019_460s.jpg' }
|
|
|
|
it 'set image content type header' 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('image/jpeg')
|
|
end
|
|
end
|
|
end
|
|
end
|