Move user enterprises definition in tests to after creation fixes a problem with enterprise_roles

This commit is contained in:
Luis Ramos
2020-02-21 14:41:46 +00:00
parent 1dc7b5793c
commit e64d21d81d

View File

@@ -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