Sha256: 16651815da7b0ad283feaadc3701a89f472602769edc5cedcc689886ed083e83

Contents?: true

Size: 1.51 KB

Versions: 10

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :enterprise_account, class: Osso::Models::EnterpriseAccount do
    transient do
      oauth_client { create(:oauth_client) }
    end
    id { SecureRandom.uuid }
    name { Faker::Company.name }
    domain { Faker::Internet.domain_name }
  end

  factory :enterprise_with_okta, parent: :enterprise_account do
    after :create do |enterprise, evaluator|
      create(
        :configured_identity_provider,
        service: 'OKTA',
        domain: enterprise.domain,
        enterprise_account_id: enterprise.id,
        oauth_client: evaluator.oauth_client,
      )
    end
  end

  factory :enterprise_with_azure, parent: :enterprise_account do
    after :create do |enterprise|
      create(
        :configured_identity_provider,
        service: 'AZURE',
        domain: enterprise.domain,
        enterprise_account_id: enterprise.id,
      )
    end
  end

  factory :enterprise_with_multiple_providers, parent: :enterprise_account do
    transient do
      oauth_client { nil }
    end
    after :create do |enterprise, evaluator|
      create(
        :configured_identity_provider,
        service: 'OKTA',
        domain: enterprise.domain,
        enterprise_account_id: enterprise.id,
        oauth_client: evaluator.oauth_client,
      )

      create(
        :configured_identity_provider,
        service: 'AZURE',
        domain: enterprise.domain,
        enterprise_account_id: enterprise.id,
        oauth_client: evaluator.oauth_client,
      )
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
osso-0.1.2 spec/factories/enterprise_account.rb
osso-0.1.1 spec/factories/enterprise_account.rb
osso-0.1.0 spec/factories/enterprise_account.rb
osso-0.0.11 spec/factories/enterprise_account.rb
osso-0.0.10 spec/factories/enterprise_account.rb
osso-0.0.8 spec/factories/enterprise_account.rb
osso-0.0.7 spec/factories/enterprise_account.rb
osso-0.0.6 spec/factories/enterprise_account.rb
osso-0.0.6.alpha spec/factories/enterprise_account.rb
osso-0.0.5 spec/factories/enterprise_account.rb