Sha256: cddac0d12057d1cd876dd9b53ccac11c980fae0e50b1b1aeb86920802f3bb292

Contents?: true

Size: 711 Bytes

Versions: 56

Compression:

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

56 entries across 56 versions & 1 rubygems

Version Path
spree_core-4.0.9 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.1.15 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.1.14 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.0.8 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.7.14.1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.1.13.1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.0.7.1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.0.7 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.7.14 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.1.13 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.0.6 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.7.13 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.0.5 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.1.12 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.7.12 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.2.0.rc1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.0.4 lib/spree/testing_support/factories/zone_factory.rb
spree_core-3.7.11 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.1.11 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.1.10 lib/spree/testing_support/factories/zone_factory.rb