Skip to content

Commit

Permalink
Merge pull request #6704 from samvera/favor-explicit-factory-bot
Browse files Browse the repository at this point in the history
🧹 Favor explicit FactoryBot.create
  • Loading branch information
dlpierce authored Feb 20, 2024
2 parents cbb5b4f + 9427f5e commit d06b1f9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions spec/factories/admin_sets_lw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

factory :adminset_lw, class: AdminSet do
transient do
user { create(:user) }
user { FactoryBot.create(:user) }

with_permission_template { false }
with_solr_document { false }
Expand Down Expand Up @@ -105,7 +105,7 @@
# Builds a pre-Hyrax 2.1.0 adminset without edit/view grants on the admin set.
# Do not use with create because the save will cause the solr grants to be created.
transient do
user { create(:user) }
user { FactoryBot.create(:user) }
with_permission_template { true }
with_solr_document { true }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/administrative_sets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

transient do
with_permission_template { false }
user { create(:user) }
user { FactoryBot.create(:user) }
access_grants { [] }
with_index { true }
end
Expand Down
6 changes: 3 additions & 3 deletions spec/factories/collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

factory :collection_lw, class: Collection do
transient do
user { create(:user) }
user { FactoryBot.create(:user) }

collection_type { nil }
collection_type_settings { nil }
Expand Down Expand Up @@ -135,7 +135,7 @@

factory :user_collection_lw, class: Collection do
transient do
user { create(:user) }
user { FactoryBot.create(:user) }
collection_type { create(:user_collection_type) }
end

Expand All @@ -151,7 +151,7 @@
# col = build(:typeless_collection, ...)
# col.save(validate: false)
transient do
user { create(:user) }
user { FactoryBot.create(:user) }
with_permission_template { false }
do_save { false }
end
Expand Down
6 changes: 3 additions & 3 deletions spec/factories/collections_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# rubocop:enable Layout/LineLength

transient do
user { create(:user) }
user { FactoryBot.create(:user) }
# allow defaulting to default user collection
collection_type_settings { nil }
with_permission_template { false }
Expand Down Expand Up @@ -59,7 +59,7 @@

factory :user_collection, class: Collection do
transient do
user { create(:user) }
user { FactoryBot.create(:user) }
collection_type { create(:user_collection_type) }
end

Expand All @@ -75,7 +75,7 @@
# col = build(:typeless_collection, ...)
# col.save(validate: false)
transient do
user { create(:user) }
user { FactoryBot.create(:user) }
with_permission_template { false }
create_access { false }
do_save { false }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/file_sets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FactoryBot.define do
factory :file_set do
transient do
user { create(:user) }
user { FactoryBot.create(:user) }
content { nil }
end
after(:build) do |fs, evaluator|
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/generic_works.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FactoryBot.define do
factory :work, aliases: [:generic_work, :private_generic_work], class: 'GenericWork' do
transient do
user { create(:user) }
user { FactoryBot.create(:user) }
# Set to true (or a hash) if you want to create an admin set
with_admin_set { false }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/hyrax_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
with_permission_template { true }
collection_type { nil }
with_index { true }
user { create(:user) }
user { FactoryBot.create(:user) }
edit_groups { [] }
edit_users { [] }
read_groups { [] }
Expand Down

0 comments on commit d06b1f9

Please sign in to comment.