Sha256: 3bc10e338e5fd6d26a4815dda9b8c62166e2ba9856004c5552016030a783d1b2

Contents?: true

Size: 707 Bytes

Versions: 20

Compression:

Stored size: 707 Bytes

Contents

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

  factory :zone, class: Spree::Zone do
    name { generate(:random_string) }
    description { generate(:random_string) }

    factory :zone_with_country do
      zone_members do |proxy|
        zone = proxy.instance_eval { @instance }
        country = create(:country)
        [Spree::ZoneMember.create(zoneable: country, zone: zone)]
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
spree_core-3.4.6 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.2.9 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.6.6 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.6.5 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.6.4 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.6.3 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.6.2 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.6.1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.6.0 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.5.0 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.3.6 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.2.8 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.6.0.rc1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.5.0.rc2 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.5.0.rc1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.4.5 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.3.5 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.4.4 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.4.3 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.4.2 lib/spree/testing_support/factories/zone_factory.rb