Use mime type symbol to set content_type for custom css response (#37845)
This commit is contained in:
parent
5f33cf0b0a
commit
1232b55211
@ -3,7 +3,7 @@
|
|||||||
class CustomCssController < ActionController::Base # rubocop:disable Rails/ApplicationController
|
class CustomCssController < ActionController::Base # rubocop:disable Rails/ApplicationController
|
||||||
def show
|
def show
|
||||||
expires_in 1.month, public: true
|
expires_in 1.month, public: true
|
||||||
render content_type: 'text/css'
|
render content_type: :css
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@ -13,11 +13,10 @@ RSpec.describe 'Custom CSS' do
|
|||||||
expect(response)
|
expect(response)
|
||||||
.to have_http_status(200)
|
.to have_http_status(200)
|
||||||
.and have_cacheable_headers
|
.and have_cacheable_headers
|
||||||
.and have_attributes(
|
expect(response.media_type)
|
||||||
content_type: match('text/css')
|
.to eq('text/css')
|
||||||
)
|
expect(response.body)
|
||||||
expect(response.body.presence)
|
.to be_blank
|
||||||
.to be_nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -32,9 +31,8 @@ RSpec.describe 'Custom CSS' do
|
|||||||
expect(response)
|
expect(response)
|
||||||
.to have_http_status(200)
|
.to have_http_status(200)
|
||||||
.and have_cacheable_headers
|
.and have_cacheable_headers
|
||||||
.and have_attributes(
|
expect(response.media_type)
|
||||||
content_type: match('text/css')
|
.to eq('text/css')
|
||||||
)
|
|
||||||
expect(response.body.strip)
|
expect(response.body.strip)
|
||||||
.to eq(expected_css)
|
.to eq(expected_css)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user