Assign officer assignment when creating voter from booth
If `officer_assigment' is not set the model cannot be validated, because it cannot be blank.
This commit is contained in:
@@ -93,6 +93,11 @@ FactoryBot.define do
|
||||
trait :from_booth do
|
||||
association :booth_assignment, factory: :poll_booth_assignment
|
||||
origin "booth"
|
||||
before :create do |voter|
|
||||
voter.officer_assignment = create(:poll_officer_assignment,
|
||||
officer: voter.officer,
|
||||
booth_assignment: voter.booth_assignment)
|
||||
end
|
||||
end
|
||||
|
||||
trait :valid_document do
|
||||
|
||||
Reference in New Issue
Block a user