Two factor authentication extension for Devise
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
561 B

module AuthenticatedModelHelper
def build_guest_user
GuestUser.new
end
def create_user(attributes={})
User.create!(valid_attributes(attributes))
end
def valid_attributes(attributes={})
{
nickname: 'Marissa',
email: generate_unique_email,
password: 'password',
password_confirmation: 'password'
}.merge(attributes)
end
def generate_unique_email
@@email_count ||= 0
@@email_count += 1
"user#{@@email_count}@example.com"
end
end
RSpec.configuration.send(:include, AuthenticatedModelHelper)