Sha256: 8cc2fa78946ff41331d67736cda6f7d6aaa1305e5dc89fcb4c75b5371ecab920

Contents?: true

Size: 1.3 KB

Versions: 19

Compression:

Stored size: 1.3 KB

Contents

# Read about factories at https://github.com/thoughtbot/factory_girl

# This is an API resource factory generating a Hash to be used in API stubs
# Use as such: build(:api_user)
# See http://stackoverflow.com/questions/10032760/how-to-define-an-array-hash-in-factory-girl
FactoryGirl.define do
  
  factory :user, class: MnoEnterprise::User do
    sequence(:id)
    sequence(:uid) { |n| "usr-fda9#{n}" }
    name "John"
    surname "Doe"
    sequence(:email) { |n| "john.doe#{n}@maestrano.com" }
    company "Doe Inc."
    phone "449 789 456"
    phone_country_code "AU"
    geo_country_code "AU"
    geo_state_code "NSW"
    geo_city "Sydney"
    created_at 2.days.ago
    updated_at 2.days.ago
    sso_session "1fdd5sf5a73D7sd1as2a4sd541"
    admin_role false

    confirmation_sent_at 2.days.ago
    confirmation_token "wky763pGjtzWR7dP44PD"
    confirmed_at 1.days.ago
    
    trait :unconfirmed do
      confirmed_at nil
    end

    trait :admin do
      admin_role true
    end

    trait :with_deletion_request do
      deletion_request { build(:deletion_request).attributes }
    end
    
    trait :with_organizations do
      organizations { [build(:organization).attributes] }
    end
    
    # Properly build the resource with Her
    initialize_with { new(attributes).tap { |e| e.clear_attribute_changes! } }
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mno-enterprise-core-3.0.7 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.9 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-3.0.6 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.8 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-3.0.5 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.7 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.6 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.5 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-3.0.4 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.4 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-3.1.0 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-3.0.3 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.3 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-3.0.2 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.2 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-3.0.1 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.1 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-3.0.0 lib/mno_enterprise/testing_support/factories/users.rb
mno-enterprise-core-2.0.0 lib/mno_enterprise/testing_support/factories/users.rb