Sha256: eb93dca113b06f05c039f013f7eb2caf24b758ca2f9876a68e7487442e21520d

Contents?: true

Size: 1.73 KB

Versions: 15

Compression:

Stored size: 1.73 KB

Contents

require 'factory_girl_rails'

FactoryGirl.define do
  factory :g5_authenticatable_user, class: 'G5Authenticatable::User' do
    sequence(:email) { |n| "test.user#{n}@test.host" }
    provider 'g5'
    sequence(:uid) { |n| "abc123-#{n}" }
    sequence(:g5_access_token) { |n| "secret_token_#{n}" }
    first_name 'Jane'
    last_name 'Doe'
    phone_number '(555) 867-5309'
    title 'Minister of Funny Walks'
    organization_name 'Department of Redundancy Department'

    after(:build) do |user|
      user.roles << FactoryGirl.build(:g5_authenticatable_viewer_role)
    end
  end

  factory :g5_authenticatable_super_admin, parent: :g5_authenticatable_user do
    after(:build) do |user|
      user.roles.clear
      user.roles << FactoryGirl.build(:g5_authenticatable_super_admin_role)
    end
  end

  factory :g5_authenticatable_admin, parent: :g5_authenticatable_user do
    after(:build) do |user|
      user.roles.clear
      user.roles << FactoryGirl.build(:g5_authenticatable_admin_role)
    end
  end

  factory :g5_authenticatable_editor, parent: :g5_authenticatable_user do
    after(:build) do |user|
      user.roles.clear
      user.roles << FactoryGirl.build(:g5_authenticatable_editor_role)
    end
  end

  factory :g5_authenticatable_role, class: 'G5Authenticatable::Role' do
    sequence(:name) { |n| "role_#{n}" }
  end

  factory :g5_authenticatable_super_admin_role, parent: :g5_authenticatable_role do
    name 'super_admin'
  end

  factory :g5_authenticatable_admin_role, parent: :g5_authenticatable_role do
    name 'admin'
  end

  factory :g5_authenticatable_editor_role, parent: :g5_authenticatable_role do
    name 'editor'
  end

  factory :g5_authenticatable_viewer_role, parent: :g5_authenticatable_role do
    name 'viewer'
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
g5_authenticatable-0.9.1.pre.2 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.8.1.pre lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.8.0 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.8.0.beta1 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.7.5 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.7.5.beta lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.7.4 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.7.4.beta.1 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.7.3 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.7.2 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.7.1 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.7.0 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.6.0 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.5.1 lib/g5_authenticatable/test/factory.rb
g5_authenticatable-0.5.0 lib/g5_authenticatable/test/factory.rb