projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
20877: Add test for trashing project
[arvados.git]
/
services
/
api
/
test
/
factories
/
user.rb
diff --git
a/services/api/test/factories/user.rb
b/services/api/test/factories/user.rb
index 56e91252171d4ab4d70c633dc69ceaebe95505b1..91d939516485328ba492717b55d60ba9de216793 100644
(file)
--- a/
services/api/test/factories/user.rb
+++ b/
services/api/test/factories/user.rb
@@
-1,12
+1,18
@@
-include CurrentApiClient
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
-FactoryGirl.define do
+class CurrentApiClientHelper
+ extend CurrentApiClient
+end
+
+FactoryBot.define do
factory :user do
factory :user do
-
ignore
do
- join_groups
[]
+
transient
do
+ join_groups
{ [] }
end
after :create do |user, evaluator|
end
after :create do |user, evaluator|
- act_as_system_user do
+
CurrentApiClientHelper.
act_as_system_user do
evaluator.join_groups.each do |g|
Link.create!(tail_uuid: user.uuid,
head_uuid: g.uuid,
evaluator.join_groups.each do |g|
Link.create!(tail_uuid: user.uuid,
head_uuid: g.uuid,
@@
-19,15
+25,15
@@
FactoryGirl.define do
end
end
end
end
end
end
- first_name
"Factory"
- last_name
"Factory"
+ first_name
{ "Factory" }
+ last_name
{ "Factory" }
identity_url do
"https://example.com/#{rand(2**24).to_s(36)}"
end
factory :active_user do
identity_url do
"https://example.com/#{rand(2**24).to_s(36)}"
end
factory :active_user do
- is_active
true
+ is_active
{ true }
after :create do |user|
after :create do |user|
- act_as_system_user do
+
CurrentApiClientHelper.
act_as_system_user do
Link.create!(tail_uuid: user.uuid,
head_uuid: Group.where('uuid ~ ?', '-f+$').first.uuid,
link_class: 'permission',
Link.create!(tail_uuid: user.uuid,
head_uuid: Group.where('uuid ~ ?', '-f+$').first.uuid,
link_class: 'permission',
@@
-36,7
+42,7
@@
FactoryGirl.define do
end
end
to_create do |instance|
end
end
to_create do |instance|
- act_as_system_user do
+
CurrentApiClientHelper.
act_as_system_user do
instance.save!
end
end
instance.save!
end
end