mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: validates 'ThemeField' name when used in a SCSS variable
This commit is contained in:
@ -29,4 +29,19 @@ HTML
|
||||
expect(field.error).to eq(nil)
|
||||
end
|
||||
|
||||
def create_upload_theme_field!(name)
|
||||
ThemeField.create!(
|
||||
theme_id: 1,
|
||||
target_id: 0,
|
||||
value: "",
|
||||
type_id: ThemeField.types[:theme_upload_var],
|
||||
name: name,
|
||||
)
|
||||
end
|
||||
|
||||
it "ensures we don't use invalid SCSS variable names" do
|
||||
expect { create_upload_theme_field!("42") }.to raise_error(ActiveRecord::RecordInvalid)
|
||||
expect { create_upload_theme_field!("a42") }.not_to raise_error
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user