Sha256: 6638ecf1e96aaa7d7fb4e7c5e6af94c39477eecb8c47cff3e9057598b5b07c5f

Contents?: true

Size: 444 Bytes

Versions: 23

Compression:

Stored size: 444 Bytes

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :taxon, class: 'Spree::Taxon' do
    name { 'Ruby on Rails' }
    taxonomy_id { (parent&.taxonomy || create(:taxonomy)).id }
    parent_id { parent&.id || taxonomy.root.id }

    trait :with_icon do
      after(:create) do |taxon|
        taxon.update(icon: Spree::Core::Engine.root.join('lib', 'spree', 'testing_support', 'fixtures', 'blank.jpg').open)
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
solidus_core-4.0.1 lib/spree/testing_support/factories/taxon_factory.rb
solidus_core-4.1.0 lib/spree/testing_support/factories/taxon_factory.rb
solidus_core-4.0.0 lib/spree/testing_support/factories/taxon_factory.rb