Sha256: 88888bc679fde0956c5c42f35541ed2e0a2f3c79f06f1a802ccd852d7820d823

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

require 'spree/testing_support/sequences'
require 'spree/testing_support/factories/country_factory'

FactoryBot.define do
  factory :global_zone, class: 'Spree::Zone' do
    name 'GlobalZone'
    zone_members do |proxy|
      zone = proxy.instance_eval { @instance }
      Spree::Country.all.map do |c|
        Spree::ZoneMember.create(zoneable: c, zone: zone)
      end
    end
  end

  factory :zone, class: 'Spree::Zone' do
    sequence(:name) { |i| "Zone #{i}" }

    trait :with_country do
      countries { [create(:country)] }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_core-2.6.2 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.6.1 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.6.0 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.6.0.rc1 lib/spree/testing_support/factories/zone_factory.rb