summaryrefslogtreecommitdiff
path: root/features/steps/shared/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'features/steps/shared/user.rb')
-rw-r--r--features/steps/shared/user.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/features/steps/shared/user.rb b/features/steps/shared/user.rb
new file mode 100644
index 00000000000..209d77c7acf
--- /dev/null
+++ b/features/steps/shared/user.rb
@@ -0,0 +1,17 @@
+module SharedUser
+ include Spinach::DSL
+
+ step 'User "John Doe" exists' do
+ user_exists("John Doe", {username: "john_doe"})
+ end
+
+ 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