Skip to content

Commit

Permalink
add :with_member_works_and_file_sets trait for hyrax_work factory
Browse files Browse the repository at this point in the history
  • Loading branch information
tamsin johnson committed Aug 23, 2023
1 parent f18cdb3 commit db4d46b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion spec/factories/hyrax_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
trait :with_member_works do
transient do
members do
# If you set a depositor on the containing work, propogate that into these members
# If eyou set a depositor on the containing work, propogate that into these members
additional_attributes = {}
additional_attributes[:depositor] = depositor if depositor
[valkyrie_create(:hyrax_work, additional_attributes), valkyrie_create(:hyrax_work, additional_attributes)]
Expand All @@ -83,6 +83,20 @@
end

trait :with_member_file_sets do
transient do
members do
# If you set a depositor on the containing work, propogate that into these members
additional_attributes = {}
additional_attributes[:depositor] = depositor if depositor
[valkyrie_create(:hyrax_work, additional_attributes),
valkyrie_create(:hyrax_work, additional_attributes),
valkyrie_create(:hyrax_file_set, additional_attributes),
valkyrie_create(:hyrax_file_set, additional_attributes)]
end
end
end

trait :with_member_works_and_file_sets do
transient do
members do
# If you set a depositor on the containing work, propogate that into these members
Expand Down

0 comments on commit db4d46b

Please sign in to comment.