summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-06-28 22:04:49 +0900
committerShinya Maeda <shinya@gitlab.com>2017-06-28 22:04:49 +0900
commitd9d5600711426d280cc1768820e809357293f14d (patch)
tree8e870ad99d81d3f86bce5375e29597577f779266 /spec
parentaf129038e089cfc91df08d14826fa9279252d7e9 (diff)
downloadgitlab-ce-d9d5600711426d280cc1768820e809357293f14d.tar.gz
Make membership required for create_user_by_membership
Diffstat (limited to 'spec')
-rw-r--r--spec/support/matchers/access_matchers_for_controller.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/support/matchers/access_matchers_for_controller.rb b/spec/support/matchers/access_matchers_for_controller.rb
index c951c6b754d..fb43f51c70c 100644
--- a/spec/support/matchers/access_matchers_for_controller.rb
+++ b/spec/support/matchers/access_matchers_for_controller.rb
@@ -25,6 +25,8 @@ module AccessMatchersForController
user = role
sign_in(user)
when *Gitlab::Access.sym_options_with_owner.keys # owner, master, developer, reporter, guest
+ raise ArgumentError, "cannot emulate #{role} without membership parent" unless membership
+
user = create_user_by_membership(role, membership)
sign_in(user)
else
@@ -34,9 +36,7 @@ module AccessMatchersForController
user
end
- def create_user_by_membership(role, membership = nil)
- raise ArgumentError, "cannot emulate #{role} without membership parent" unless membership
-
+ def create_user_by_membership(role, membership)
if role == :owner && membership.owner
user = membership.owner
else