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.

28 lines
534 B

module AuthenticatedModelHelper
def build_guest_user
GuestUser.new
end
def create_user(attributes={})
User.create!(valid_attributes(attributes))
end
def valid_attributes(attributes={})
{
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)