diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-06-28 16:04:49 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-06-28 16:04:49 +0300 |
commit | d9d5600711426d280cc1768820e809357293f14d (patch) | |
tree | 8e870ad99d81d3f86bce5375e29597577f779266 /spec/support | |
parent | af129038e089cfc91df08d14826fa9279252d7e9 (diff) |
Make membership required for create_user_by_membership
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/matchers/access_matchers_for_controller.rb | 6 |
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 |