0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-26 02:50:28 +01:00
Dieser Commit ist enthalten in:
Angus McLeod 2023-02-09 14:32:01 +01:00
Ursprung e7ee89048a
Commit e5d6a20532
4 geänderte Dateien mit 8 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -8,6 +8,7 @@ describe CustomWizard::TemplateValidator do
let(:permitted_json) { get_wizard_fixture("wizard/permitted") } let(:permitted_json) { get_wizard_fixture("wizard/permitted") }
let(:composer_preview) { get_wizard_fixture("field/composer_preview") } let(:composer_preview) { get_wizard_fixture("field/composer_preview") }
let(:guests_permitted) { get_wizard_fixture("wizard/guests_permitted") } let(:guests_permitted) { get_wizard_fixture("wizard/guests_permitted") }
let(:upload_field) { get_wizard_fixture("field/upload") }
let(:valid_liquid_template) { let(:valid_liquid_template) {
<<-LIQUID.strip <<-LIQUID.strip
@ -149,6 +150,7 @@ describe CustomWizard::TemplateValidator do
it "validates user-only features" do it "validates user-only features" do
template[:permitted] = guests_permitted['permitted'] template[:permitted] = guests_permitted['permitted']
template[:steps][0][:fields] << upload_field
validator = CustomWizard::TemplateValidator.new(template) validator = CustomWizard::TemplateValidator.new(template)
expect(validator.perform).to eq(false) expect(validator.perform).to eq(false)
errors = validator.errors.to_a errors = validator.errors.to_a

6
spec/fixtures/field/upload.json gevendort Normale Datei
Datei anzeigen

@ -0,0 +1,6 @@
{
"id": "step_2_field_7",
"label": "Upload",
"type": "upload",
"file_types": ".jpg,.jpeg,.png"
}

Datei anzeigen

@ -74,12 +74,6 @@
"id": "step_2_field_5", "id": "step_2_field_5",
"label": "Checkbox", "label": "Checkbox",
"type": "checkbox" "type": "checkbox"
},
{
"id": "step_2_field_7",
"label": "Upload",
"type": "upload",
"file_types": ".jpg,.jpeg,.png"
} }
], ],
"description": "Because I couldn't think of another name for this step :)" "description": "Because I couldn't think of another name for this step :)"

Datei anzeigen

@ -29,6 +29,5 @@ describe CustomWizard::FieldSerializer do
scope: Guardian.new(user) scope: Guardian.new(user)
).as_json ).as_json
expect(json_array[0][:format]).to eq("YYYY-MM-DD") expect(json_array[0][:format]).to eq("YYYY-MM-DD")
expect(json_array[5][:file_types]).to eq(".jpg,.jpeg,.png")
end end
end end