mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
Move user enterprises definition in tests to after creation fixes a problem with enterprise_roles
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
FactoryBot.modify do
|
||||
factory :user do
|
||||
transient do
|
||||
enterprises []
|
||||
end
|
||||
|
||||
confirmation_sent_at '1970-01-01 00:00:00'
|
||||
confirmed_at '1970-01-01 00:00:01'
|
||||
|
||||
@@ -13,8 +17,10 @@ FactoryBot.modify do
|
||||
end
|
||||
end
|
||||
|
||||
after(:create) do |user|
|
||||
after(:create) do |user, proxy|
|
||||
user.spree_roles.clear # Remove admin role
|
||||
|
||||
user.enterprises << proxy.enterprises
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user