Sha256: 43c684046f4c6fcf2502b2d781e2ad5d0f10dff9cfdb88987d9be2b51e81ae72

Contents?: true

Size: 744 Bytes

Versions: 45

Compression:

Stored size: 744 Bytes

Contents

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

    factory :zone_with_country do
      kind { :country }

      zone_members do |proxy|
        zone = proxy.instance_eval { @instance }

        [Spree::ZoneMember.create(zoneable: create(:country), zone: zone)]
      end

      factory :global_zone, class: Spree::Zone do
        sequence(:name) { |n| "GlobalZone_#{n}" }

        zone_members do |proxy|
          zone = proxy.instance_eval { @instance }

          Spree::Country.all.map do |country|
            Spree::ZoneMember.where(zoneable: country, zone: zone).first_or_create
          end
        end
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
spree_core-4.10.1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.10.0 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.9.0 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.8.3 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.8.2 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.7.3 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.6.6 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.5.5 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.2.7 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.3.3 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.4.1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.5.4 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.6.5 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.7.2 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.7.1 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.6.4 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.7.0 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.6.3 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.6.2 lib/spree/testing_support/factories/zone_factory.rb
spree_core-4.6.1 lib/spree/testing_support/factories/zone_factory.rb