Feature: Dietary preferences
  As a signed-in user
  I want my regime and allergies/intolerances to autosave as I edit them
  So that my preferences are always up to date without an explicit save step

  Background:
    Given I am signed in as "Alice" "Martin"
    And my household id is 1
    And my diet id is 2
    And the dietary preferences reference data is ready

  Scenario: Autosaves the regime as soon as it's selected
    Given selecting the diet will succeed
    When I visit "/parametres/preferences"
    And I select "Omnivore" from the "diet" field
    Then the diet update request should have been made with diet id 1

  Scenario: Autosaves allergies and intolerances together after checking boxes
    Given updating allergies will succeed
    When I visit "/parametres/preferences"
    And I check the checkbox "Arachides"
    Then the allergies update request should have been made with allergy ids 2 and 1
    And I should see "Enregistré ✓"
