docbrown/spec/factories/backup_data.rb
Anna Buianova 01456fe029 [deploy] Finalize deleting user associations (#5624)
* Prepare factories and associations for Users::DeleteActivity specs

* Altered user associations, delete the needed associations in Users::DeleteActivity

* Moved and refined user deletion spec

* Removed useless commented user associations

* Refactored BackupData factory

* Refactored ProfilePin factory

* Refactored Reaction factory

* Fixed specs: Keep default _type in factories or specify it in tests

* Ok, notes shouldn't be deleted on user deletion

* Fixed creating reactable for specs

* Specify commentable/commentable_type explicitly when creating data for tests

* Fixed typo in the comments spec

* Removed unnneeded space

* Added aggregate_failures for testing user associations deletion

* Keep feedback_messages while deleting user activities
2020-01-23 11:29:47 -05:00

9 lines
335 B
Ruby

FactoryBot.define do
factory :backup_data do
association :instance_user, factory: :user
after(:build) do |backup_data|
backup_data.instance = backup_data.instance_user.identities.first || create(:identity, user: backup_data.instance_user)
backup_data.json_data = backup_data.instance.attributes
end
end
end