summaryrefslogtreecommitdiff
path: root/features/steps/shared/user.rb
diff options
context:
space:
mode:
authorCiro Santillli <ciro.santilli@gmail.com>2014-02-07 17:59:55 +0100
committerCiro Santillli <ciro.santilli@gmail.com>2014-02-12 15:52:53 +0100
commit439a61783d0b61bbcc8f3c9e5b828b2270a679aa (patch)
treee6a02b733ad2dea5bda94ea5ac25d333e1419589 /features/steps/shared/user.rb
parentc86553cd836b7be3948ace41ef47f85776a48a97 (diff)
downloadgitlab-ce-439a61783d0b61bbcc8f3c9e5b828b2270a679aa.tar.gz
User can leave group from group page.
Diffstat (limited to 'features/steps/shared/user.rb')
-rw-r--r--features/steps/shared/user.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/features/steps/shared/user.rb b/features/steps/shared/user.rb
index a2bf069a114..209d77c7acf 100644
--- a/features/steps/shared/user.rb
+++ b/features/steps/shared/user.rb
@@ -1,11 +1,17 @@
module SharedUser
include Spinach::DSL
- step 'Create user "John Doe"' do
- create(:user, name: "John Doe", username: "john_doe")
+ step 'User "John Doe" exists' do
+ user_exists("John Doe", {username: "john_doe"})
end
- step 'I sign in as "John Doe"' do
- login_with(User.find_by(name: "John Doe"))
+ step 'User "Mary Jane" exists' do
+ user_exists("Mary Jane", {username: "mary_jane"})
+ end
+
+ protected
+
+ def user_exists(name, options = {})
+ User.find_by(name: name) || create(:user, {name: name, admin: false}.merge(options))
end
end