-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathusers_steps.rb
More file actions
25 lines (21 loc) · 843 Bytes
/
users_steps.rb
File metadata and controls
25 lines (21 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true
def create_user(nickname, has_bitcoiin_address)
User.create do |user|
user.name = nickname
user.email = "#{nickname}@example.com"
user.bitcoin_address = '1AFgARu7e5d8Lox6P2DSFX3MW8BtsVXEn5' if has_bitcoiin_address
user.nickname = nickname
user.password = Devise.friendly_token.first(Devise.password_length.min)
user.skip_confirmation!
end
end
Given(/^a developer named "(.*?)" exists (with|without) a bitcoin address$/) do |nickname, with|
@users ||= {}
@users[nickname] ||= create_user(nickname, with.eql?('with'))
end
Then(/^a developer named "(.*?)" does not exist$/) do |nickname|
User.where(nickname:).first.should be_nil
end
Then(/^a developer named "(.*?)" exists$/) do |nickname|
User.where(nickname:).first.should_not be_nil
end