Sha256: d04c112d2b0a00e51291d898509c402bbd683c17a2415ddb1157eeb33fc45a4f

Contents?: true

Size: 507 Bytes

Versions: 7

Compression:

Stored size: 507 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

7 entries across 7 versions & 1 rubygems

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