Sha256: 3120b9cddc6b249ce251283ac5df51fa1e2fa49e4e8e6c6cb651f4edbbd6a5d4

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :user, class: "Archangel::User" do
    site
    sequence(:name) { |n| "User #{n}" }
    sequence(:username) { |n| "username#{n}" }
    sequence(:email) { |n| "user#{n}@example.com" }
    password "password"
    sequence(:confirmation_token) { |n| "token-#{n}" }
    confirmed_at { Time.current }
    confirmation_sent_at { Time.current }

    trait :avatar do
      avatar { fixture_file_upload(uploader_test_image) }
    end

    trait :admin do
      role "admin"
    end

    trait :editor do
      role "editor"
    end

    trait :unconfirmed do
      confirmed_at nil
    end

    trait :reset do
      reset_password_token "abc123"
      reset_password_sent_at { Time.current }
    end

    trait :locked do
      failed_attempts 10
      unlock_token "123abc"
      locked_at { Time.current }
    end

    trait :tracks do
      sign_in_count 2
      current_sign_in_at { Time.current }
      last_sign_in_at { 1.day.ago }
      current_sign_in_ip "127.0.0.1"
      last_sign_in_ip "127.0.0.1"
    end

    trait :deleted do
      deleted_at { Time.current }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
archangel-0.0.8 lib/archangel/testing_support/factories/archangel_users.rb
archangel-0.0.7 lib/archangel/testing_support/factories/archangel_users.rb
archangel-0.0.6 lib/archangel/testing_support/factories/archangel_users.rb
archangel-0.0.5 lib/archangel/testing_support/factories/archangel_users.rb
archangel-0.0.4 lib/archangel/testing_support/factories/archangel_users.rb
archangel-0.0.3 lib/archangel/testing_support/factories/archangel_users.rb
archangel-0.0.2 lib/archangel/testing_support/factories/archangel_users.rb