Sha256: 1e51da731e49aad5b465e29175e21c8468fb9494063d7189b1a327a74270ac6d

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

# frozen_string_literal: true
 
eval(ENV.fetch('FACTORY')).define do
  factory :state_ja, class: 'Spree::State' do
    transient do
      country_iso { 'MX' }
      state_code { 'JA' }

      carmen_subregion do
        carmen_country = Carmen::Country.coded(country.iso)

        carmen_country.subregions.coded(state_code) ||
          carmen_country.subregions.sort_by(&:name).first ||
          fail("Country #{country.iso} has no subregions")
      end
    end

    abbr { carmen_subregion.code }
    name { carmen_subregion.name }

    country do |country|
      Spree::Country.find_by(iso: country_iso) ||
        country.association(:country, iso: country_iso)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_payment_method_by_zone-1.0.0 lib/solidus_payment_method_by_zone/factories/state_factory.rb