Sha256: b1a55564096a4ca4c2e0564c296637a3c183f6e831e796a243a7c597ddce8188
Contents?: true
Size: 895 Bytes
Versions: 44
Compression:
Stored size: 895 Bytes
Contents
# frozen_string_literal: true require 'spree/testing_support/factory_bot' Spree::TestingSupport::FactoryBot.when_cherry_picked do Spree::TestingSupport::FactoryBot.deprecate_cherry_picking require 'spree/testing_support/factories/country_factory' end FactoryBot.define do factory :state, class: 'Spree::State' do transient do country_iso { 'US' } state_code { 'AL' } 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
44 entries across 44 versions & 1 rubygems