Sha256: bbdc8674666957a704257d3ca9573fe765a40559360aa761b516dc1b58a2f27f

Contents?: true

Size: 587 Bytes

Versions: 44

Compression:

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

44 entries across 44 versions & 2 rubygems

Version Path
solidus_core-2.10.5 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.10.3 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.10.2 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.9.6 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.8.6 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.10.1 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.9.5 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.10.0 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.9.4 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.6.6 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.7.4 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.8.5 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.9.3 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.9.2 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.10.0.beta1 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.7.3 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.6.5 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.9.1 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.9.0 lib/spree/testing_support/factories/zone_factory.rb
solidus_core-2.9.0.rc.1 lib/spree/testing_support/factories/zone_factory.rb