Sha256: 07a8cb01b7d3db88beeea169fecb926bf2f8ba71c09f624316bcdd9bfabe8af4

Contents?: true

Size: 511 Bytes

Versions: 2

Compression:

Stored size: 511 Bytes

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :collection, class: "Archangel::Collection" do
    site
    sequence(:name) { |n| "Collection #{n}" }
    sequence(:slug) { |n| "collection-#{n}" }

    trait :deleted do
      deleted_at { Time.current }
    end

    trait :with_fields do
      transient do
        fields_count { 3 }
      end

      after(:create) do |collection, evaluator|
        create_list(:field, evaluator.fields_count, collection: collection)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
archangel-0.4.0 lib/archangel/testing_support/factories/archangel_collections.rb
archangel-0.3.0 lib/archangel/testing_support/factories/archangel_collections.rb