diff --git a/app/templates/devices/shared/_fields.html.erb b/app/templates/devices/shared/_fields.html.erb index 80316def..4aaf87ec 100644 --- a/app/templates/devices/shared/_fields.html.erb +++ b/app/templates/devices/shared/_fields.html.erb @@ -5,7 +5,10 @@ <%= scope(:popover_trigger_button, tip: :info, target: :model).render %> - <%= form.select :model_id, select_options_for(models), id: :device_model_id, class: :value %> + <%= form.select :model_id, + select_options_for(models, default: default_option(models, "TRMNL OG (2-bit)")), + id: :device_model_id, + class: :value %> <% end %> <%= scope(:form_field, key: :playlist_id, errors:).render do %> @@ -137,7 +140,10 @@ <%= form.select :command, - select_options(translate("devices.shared._fields.commands")), + select_options( + translate("devices.shared._fields.commands"), + default: ["None", "none"] + ), id: :device_command, class: :value %> <% end %> diff --git a/spec/features/devices_spec.rb b/spec/features/devices_spec.rb index 5a2eba5d..683293ac 100644 --- a/spec/features/devices_spec.rb +++ b/spec/features/devices_spec.rb @@ -12,12 +12,12 @@ RSpec.describe "Devices", :db do model visit routes.path(:devices) click_link "New" - select "None", from: "Command" + select model.label, from: "device[model_id]" + fill_in "device[mac_address]", with: "Bogus!" click_button "Save" - expect(page).to have_text("must be filled") + expect(page).to have_text("is in invalid format") - select model.label, from: "device[model_id]" fill_in "device[mac_address]", with: "AA:BB:CC:11:22:33" click_button "Save" click_link "View"