mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: Return the right response code for invalid theme id.
This commit is contained in:
@ -218,6 +218,12 @@ describe Admin::ThemesController do
|
||||
describe '#update' do
|
||||
let(:theme) { Fabricate(:theme) }
|
||||
|
||||
it 'returns the right response when an invalid id is given' do
|
||||
put "/admin/themes/99999.json"
|
||||
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
||||
it 'can change default theme' do
|
||||
SiteSetting.default_theme_id = -1
|
||||
|
||||
@ -342,6 +348,12 @@ describe Admin::ThemesController do
|
||||
describe '#destroy' do
|
||||
let(:theme) { Fabricate(:theme) }
|
||||
|
||||
it 'returns the right response when an invalid id is given' do
|
||||
delete "/admin/themes/9999.json"
|
||||
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
||||
it "deletes the field's javascript cache" do
|
||||
theme.set_field(target: :common, name: :header, value: '<script>console.log("test")</script>')
|
||||
theme.save!
|
||||
@ -356,4 +368,12 @@ describe Admin::ThemesController do
|
||||
expect { javascript_cache.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#preview' do
|
||||
it "should return the right response when an invalid id is given" do
|
||||
get "/admin/themes/9999/preview.json"
|
||||
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user