REFACTOR: stylesheets controller specs to requests
This commit is contained in:
parent
a8d33603f9
commit
37829a521a
|
@ -1,9 +1,7 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe StylesheetsController do
|
describe StylesheetsController do
|
||||||
|
|
||||||
it 'can survive cache miss' do
|
it 'can survive cache miss' do
|
||||||
|
|
||||||
StylesheetCache.destroy_all
|
StylesheetCache.destroy_all
|
||||||
builder = Stylesheet::Manager.new('desktop_rtl', nil)
|
builder = Stylesheet::Manager.new('desktop_rtl', nil)
|
||||||
builder.compile
|
builder.compile
|
||||||
|
@ -11,8 +9,8 @@ describe StylesheetsController do
|
||||||
digest = StylesheetCache.first.digest
|
digest = StylesheetCache.first.digest
|
||||||
StylesheetCache.destroy_all
|
StylesheetCache.destroy_all
|
||||||
|
|
||||||
get :show, params: { name: "desktop_rtl_#{digest}" }, format: :json
|
get "/stylesheets/desktop_rtl_#{digest}.css"
|
||||||
expect(response).to be_successful
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
cached = StylesheetCache.first
|
cached = StylesheetCache.first
|
||||||
expect(cached.target).to eq 'desktop_rtl'
|
expect(cached.target).to eq 'desktop_rtl'
|
||||||
|
@ -21,11 +19,10 @@ describe StylesheetsController do
|
||||||
# tmp folder destruction and cached
|
# tmp folder destruction and cached
|
||||||
`rm #{Stylesheet::Manager.cache_fullpath}/*`
|
`rm #{Stylesheet::Manager.cache_fullpath}/*`
|
||||||
|
|
||||||
get :show, params: { name: "desktop_rtl_#{digest}" }, format: :json
|
get "/stylesheets/desktop_rtl_#{digest}.css"
|
||||||
expect(response).to be_successful
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
# there is an edge case which is ... disk and db cache is nuked, very unlikely to happen
|
# there is an edge case which is ... disk and db cache is nuked, very unlikely to happen
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can lookup theme specific css' do
|
it 'can lookup theme specific css' do
|
||||||
|
@ -37,34 +34,25 @@ describe StylesheetsController do
|
||||||
|
|
||||||
`rm #{Stylesheet::Manager.cache_fullpath}/*`
|
`rm #{Stylesheet::Manager.cache_fullpath}/*`
|
||||||
|
|
||||||
get :show, params: {
|
get "/stylesheets/#{builder.stylesheet_filename.sub(".css", "")}.css"
|
||||||
name: builder.stylesheet_filename.sub(".css", "")
|
|
||||||
}, format: :json
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
get :show, params: {
|
get "/stylesheets/#{builder.stylesheet_filename_no_digest.sub(".css", "")}.css"
|
||||||
name: builder.stylesheet_filename_no_digest.sub(".css", "")
|
|
||||||
}, format: :json
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
builder = Stylesheet::Manager.new(:desktop_theme, theme.key)
|
builder = Stylesheet::Manager.new(:desktop_theme, theme.key)
|
||||||
builder.compile
|
builder.compile
|
||||||
|
|
||||||
`rm #{Stylesheet::Manager.cache_fullpath}/*`
|
`rm #{Stylesheet::Manager.cache_fullpath}/*`
|
||||||
|
|
||||||
get :show, params: {
|
get "/stylesheets/#{builder.stylesheet_filename.sub(".css", "")}.css"
|
||||||
name: builder.stylesheet_filename.sub(".css", "")
|
|
||||||
}, format: :json
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
get :show, params: {
|
get "/stylesheets/#{builder.stylesheet_filename_no_digest.sub(".css", "")}.css"
|
||||||
name: builder.stylesheet_filename_no_digest.sub(".css", "")
|
|
||||||
}, format: :json
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
expect(response.status).to eq(200)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue