Sha256: c5978c3d0f5b97263b4dcadbecb560d3abcf7815de808421c4c0f26f10b8fee1

Contents?: true

Size: 561 Bytes

Versions: 4

Compression:

Stored size: 561 Bytes

Contents

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)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
two_factor_authentication-1.1.4 spec/support/authenticated_model_helper.rb
two_factor_authentication-1.1.3 spec/support/authenticated_model_helper.rb
two_factor_authentication-1.1.1 spec/support/authenticated_model_helper.rb
two_factor_authentication-1.1 spec/support/authenticated_model_helper.rb