Sha256: 36889c4e5981cbf09eb5c5741f7bbf7b27910035e6952b00e80e09f0e6ac3849

Contents?: true

Size: 695 Bytes

Versions: 1

Compression:

Stored size: 695 Bytes

Contents

module TestHelpers
  def valid_attributes(attributes={})
    { :username => "usertest",
      :email => generate_unique_email,
      :password => '12345678',
      :password_confirmation => '12345678' }.update(attributes)
  end

  email_count = 0
  define_method :generate_unique_email do
    email_count += 1
    "test#{email_count}@example.com"
  end

  def new_user(attributes={})
    User.new(valid_attributes(attributes))
  end

  def create_user(attributes={})
    User.create!(valid_attributes(attributes))
  end

  def new_admin(attributes={})
    Admin.new(valid_attributes(attributes))
  end

  def create_admin(attributes={})
    Admin.create!(valid_attributes(attributes))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise-async-0.8.0 test/support/test_helpers.rb