* Require profile fields to belong to a group Remove the empty group dropdown from the group select tag Remove the optional: true from the belongs_to validation (raise a validation error on save if the group is not provided) Update test to remove belongs_to's optional setting * Update ProfileFields::Add spec to include profile field group * update factory to ensure a non-empty profile field group * Add required profile field group to seeded profile fields Since profile field is required, create was failing (silently). Add required field so these are available in e2e tests. * Use factory `association` to create a profile field group https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#explicit-definition * provide required profile field group when posting data * Fix one spec, drop another Both of these scripts will be removed in the other branch (changing the attribute name) - dropping the test here seems lower trouble than modifying an out of data data update script to pass. * skip test slated for removal Similar to the last commit - this test exercises a script about to be archived in the other branch.
25 lines
665 B
Ruby
25 lines
665 B
Ruby
FactoryBot.define do
|
|
factory :profile_field do
|
|
association :profile_field_group
|
|
sequence(:label) { |n| "Email #{n}" }
|
|
input_type { :text_field }
|
|
description { "some description" }
|
|
placeholder_text { "john.doe@example.com" }
|
|
show_in_onboarding { false }
|
|
display_area { :left_sidebar }
|
|
|
|
trait :onboarding do
|
|
show_in_onboarding { true }
|
|
end
|
|
|
|
trait :header do
|
|
display_area { :header }
|
|
end
|
|
|
|
after :create do
|
|
# this is accomplished by ProfileFields::Add normally, it was added here
|
|
# in case the tests use the factory and not the service object
|
|
Profile.refresh_attributes!
|
|
end
|
|
end
|
|
end
|