FEATURE: Implement new required options in admin user fields UI (#27079)

We're planning to implement a feature that allows adding required fields for existing users. This PR does some preparatory refactoring to make that possible. There should be no changes to existing behaviour. Just a small update to the admin UI.
This commit is contained in:
Ted Johansson
2024-05-23 19:18:25 +08:00
committed by GitHub
parent f5e41f0627
commit 7b437c9401
16 changed files with 234 additions and 37 deletions

View File

@ -17,6 +17,7 @@ RSpec.describe Admin::UserFieldsController do
name: "hello",
description: "hello desc",
field_type: "text",
requirement: "on_signup",
},
}
@ -33,6 +34,7 @@ RSpec.describe Admin::UserFieldsController do
description: "hello desc",
field_type: "dropdown",
options: %w[a b c],
requirement: "on_signup",
},
}
@ -162,13 +164,16 @@ RSpec.describe Admin::UserFieldsController do
name: "fraggle",
field_type: "confirm",
description: "muppet",
requirement: "optional",
},
}
expect(response.status).to eq(200)
user_field.reload
expect(user_field.name).to eq("fraggle")
expect(user_field.field_type).to eq("confirm")
expect(user_field.reload).to have_attributes(
name: "fraggle",
field_type: "confirm",
required?: false,
)
end
it "updates the user field options" do