solidus_core 2.11.4 → 2.11.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_core might be problematic. Click here for more details.

Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/spree/address.rb +28 -5
  3. data/app/models/spree/order_merger.rb +1 -1
  4. data/app/models/spree/payment.rb +10 -3
  5. data/app/models/spree/product.rb +8 -2
  6. data/app/models/spree/shipping_method.rb +1 -1
  7. data/app/models/spree/stock/availability_validator.rb +2 -2
  8. data/app/models/spree/stock/inventory_validator.rb +2 -2
  9. data/app/models/spree/taxon/active_storage_attachment.rb +1 -2
  10. data/app/models/spree/taxon/paperclip_attachment.rb +1 -0
  11. data/db/migrate/20210122110141_add_name_to_spree_addresses.rb +13 -0
  12. data/lib/generators/spree/dummy/templates/rails/test.rb +3 -0
  13. data/lib/spree/core.rb +0 -4
  14. data/lib/spree/core/engine.rb +6 -7
  15. data/lib/spree/core/version.rb +1 -1
  16. data/lib/spree/testing_support.rb +19 -28
  17. data/lib/spree/testing_support/dummy_app.rb +4 -2
  18. data/lib/spree/testing_support/dummy_app/mailer_previews/test_mailer_preview.rb +4 -0
  19. data/lib/spree/testing_support/factories.rb +8 -2
  20. data/lib/spree/testing_support/factories/address_factory.rb +6 -2
  21. data/lib/spree/testing_support/factories/adjustment_factory.rb +10 -2
  22. data/lib/spree/testing_support/factories/adjustment_reason_factory.rb +4 -2
  23. data/lib/spree/testing_support/factories/calculator_factory.rb +4 -2
  24. data/lib/spree/testing_support/factories/carton_factory.rb +7 -2
  25. data/lib/spree/testing_support/factories/country_factory.rb +4 -2
  26. data/lib/spree/testing_support/factories/credit_card_factory.rb +4 -2
  27. data/lib/spree/testing_support/factories/customer_return_factory.rb +8 -2
  28. data/lib/spree/testing_support/factories/image_factory.rb +4 -2
  29. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +9 -2
  30. data/lib/spree/testing_support/factories/line_item_factory.rb +7 -2
  31. data/lib/spree/testing_support/factories/option_type_factory.rb +7 -2
  32. data/lib/spree/testing_support/factories/option_value_factory.rb +4 -2
  33. data/lib/spree/testing_support/factories/order_factory.rb +11 -2
  34. data/lib/spree/testing_support/factories/order_promotion_factory.rb +7 -2
  35. data/lib/spree/testing_support/factories/payment_factory.rb +9 -2
  36. data/lib/spree/testing_support/factories/payment_method_factory.rb +4 -2
  37. data/lib/spree/testing_support/factories/price_factory.rb +6 -2
  38. data/lib/spree/testing_support/factories/product_factory.rb +10 -2
  39. data/lib/spree/testing_support/factories/product_option_type_factory.rb +7 -2
  40. data/lib/spree/testing_support/factories/product_property_factory.rb +7 -2
  41. data/lib/spree/testing_support/factories/promotion_category_factory.rb +4 -2
  42. data/lib/spree/testing_support/factories/promotion_code_factory.rb +7 -2
  43. data/lib/spree/testing_support/factories/promotion_factory.rb +7 -2
  44. data/lib/spree/testing_support/factories/property_factory.rb +4 -2
  45. data/lib/spree/testing_support/factories/refund_factory.rb +7 -2
  46. data/lib/spree/testing_support/factories/refund_reason_factory.rb +4 -2
  47. data/lib/spree/testing_support/factories/reimbursement_factory.rb +6 -2
  48. data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +4 -2
  49. data/lib/spree/testing_support/factories/return_authorization_factory.rb +8 -2
  50. data/lib/spree/testing_support/factories/return_item_factory.rb +8 -2
  51. data/lib/spree/testing_support/factories/return_reason_factory.rb +4 -2
  52. data/lib/spree/testing_support/factories/role_factory.rb +4 -2
  53. data/lib/spree/testing_support/factories/shipment_factory.rb +9 -2
  54. data/lib/spree/testing_support/factories/shipping_category_factory.rb +4 -2
  55. data/lib/spree/testing_support/factories/shipping_method_factory.rb +8 -2
  56. data/lib/spree/testing_support/factories/shipping_rate_factory.rb +7 -2
  57. data/lib/spree/testing_support/factories/state_factory.rb +7 -2
  58. data/lib/spree/testing_support/factories/stock_item_factory.rb +7 -2
  59. data/lib/spree/testing_support/factories/stock_location_factory.rb +8 -2
  60. data/lib/spree/testing_support/factories/stock_movement_factory.rb +6 -2
  61. data/lib/spree/testing_support/factories/stock_package_factory.rb +7 -2
  62. data/lib/spree/testing_support/factories/store_credit_category_factory.rb +4 -2
  63. data/lib/spree/testing_support/factories/store_credit_event_factory.rb +7 -2
  64. data/lib/spree/testing_support/factories/store_credit_factory.rb +8 -2
  65. data/lib/spree/testing_support/factories/store_credit_reason_factory.rb +4 -2
  66. data/lib/spree/testing_support/factories/store_credit_type_factory.rb +4 -2
  67. data/lib/spree/testing_support/factories/store_factory.rb +4 -2
  68. data/lib/spree/testing_support/factories/tax_category_factory.rb +7 -2
  69. data/lib/spree/testing_support/factories/tax_rate_factory.rb +8 -2
  70. data/lib/spree/testing_support/factories/taxon_factory.rb +6 -2
  71. data/lib/spree/testing_support/factories/taxonomy_factory.rb +4 -2
  72. data/lib/spree/testing_support/factories/user_factory.rb +8 -2
  73. data/lib/spree/testing_support/factories/variant_factory.rb +9 -2
  74. data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +7 -2
  75. data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +8 -2
  76. data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +7 -2
  77. data/lib/spree/testing_support/factories/zone_factory.rb +7 -2
  78. data/lib/spree/testing_support/factory_bot.rb +68 -0
  79. data/lib/spree/testing_support/order_walkthrough.rb +9 -9
  80. data/lib/spree/testing_support/sequences.rb +4 -1
  81. data/lib/tasks/migrations/migrate_address_names.rake +158 -0
  82. data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +38 -0
  83. data/lib/tasks/upgrade.rake +13 -0
  84. data/solidus_core.gemspec +23 -1
  85. metadata +30 -6
  86. data/lib/spree/awesome_nested_set_override.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c2f2034c2f239923f522b08eeb9e6da4925058e86026d70d69cccf42ea975b9
4
- data.tar.gz: c0f56fb7091eace3ef9a91a34846035a2f0bdffd248ad5ca9ae204a7d8faae68
3
+ metadata.gz: 5e525e5e27176da6331f5bce6a0075f2c06f2da77f9d8aad9d78a861a121219c
4
+ data.tar.gz: f828d4522d8c58822fc71daa609b7411102dbdcf55e7abb4f582102c23ddbfbd
5
5
  SHA512:
6
- metadata.gz: a2e41a38b785af3e8da52ac03b86c9b1179cd2a92ec59a32c77ae6d54398115c99679ad8024b6f2988d95ddf515a9df2e0b118a687a239c2afb0920c17493b5f
7
- data.tar.gz: d023f2e92ee65585e76103d5a8921f3525965480984fc9f0f48e7f69c76d5671d98bdc4d388112ee52c8b3f1f68a1ae51a215be903ef66ee1d5958c1a2c64009
6
+ metadata.gz: ca14ba69f5a7347fd1bc88d8d209e4ffbe2d4a9419fd257f036391d55581250569ac66683a6b5c27a1342f4b5f8120b0483ba16538f8107ded796bda44551c6d
7
+ data.tar.gz: f36de4fb9dc7addc88b586277f111b854dbbcfba3d586d52a62c2c4aaddc19e6bf536b74151a461df11566d3609df6fbc60889e70b9bbded67dc6ae740ae64dc
@@ -92,6 +92,12 @@ module Spree
92
92
  if base['lastname'].presence || base['last_name'].presence
93
93
  base['lastname'] = name_from_attributes.last_name
94
94
  end
95
+
96
+ virtual_name = name_from_attributes.value
97
+ if base['name'].blank? && virtual_name.present?
98
+ base['name'] = virtual_name
99
+ end
100
+
95
101
  excluded_attributes = DB_ONLY_ATTRS + %w(first_name last_name)
96
102
 
97
103
  base.except(*excluded_attributes)
@@ -120,7 +126,11 @@ module Spree
120
126
  # @return [Boolean] true if the two addresses have the same address fields
121
127
  def ==(other_address)
122
128
  return false unless other_address && other_address.respond_to?(:value_attributes)
123
- value_attributes == other_address.value_attributes
129
+ if Spree::Config.use_combined_first_and_last_name_in_address
130
+ value_attributes.except(*LEGACY_NAME_ATTRS) == other_address.value_attributes.except(*LEGACY_NAME_ATTRS)
131
+ else
132
+ value_attributes == other_address.value_attributes
133
+ end
124
134
  end
125
135
 
126
136
  # @deprecated Do not use this. Use Address.== instead.
@@ -193,17 +203,30 @@ module Spree
193
203
  country && country.iso
194
204
  end
195
205
 
206
+ before_save :set_name_from_firstname_and_lastname
207
+
208
+ def set_name_from_firstname_and_lastname
209
+ name_from_firstname_and_lastname = Spree::Address::Name.from_attributes(attributes.except(:name, 'name'))
210
+
211
+ if read_attribute(:name).blank? && name_from_firstname_and_lastname.present?
212
+ write_attribute(:name, name_from_firstname_and_lastname)
213
+ end
214
+ end
215
+
196
216
  # @return [String] the full name on this address
197
217
  def name
198
- Spree::Address::Name.new(
199
- read_attribute(:firstname),
200
- read_attribute(:lastname)
201
- ).value
218
+ self[:name] || begin
219
+ Spree::Address::Name.new(
220
+ read_attribute(:firstname),
221
+ read_attribute(:lastname)
222
+ ).value
223
+ end
202
224
  end
203
225
 
204
226
  def name=(value)
205
227
  return if value.nil?
206
228
 
229
+ write_attribute(:name, value)
207
230
  name_from_value = Spree::Address::Name.new(value)
208
231
  write_attribute(:firstname, name_from_value.first_name)
209
232
  write_attribute(:lastname, name_from_value.last_name)
@@ -128,7 +128,7 @@ module Spree
128
128
  # @param [Spree::LineItem] line_item The line item which could not be saved
129
129
  # @return [void]
130
130
  def handle_error(line_item)
131
- order.errors[:base] << line_item.errors.full_messages
131
+ order.errors.add(:base, line_item.errors.full_messages)
132
132
  end
133
133
 
134
134
  # Save the order totals after merge
@@ -168,9 +168,16 @@ module Spree
168
168
 
169
169
  def validate_source
170
170
  if source && !source.valid?
171
- source.errors.each do |field, error|
172
- field_name = I18n.t("activerecord.attributes.#{source.class.to_s.underscore}.#{field}")
173
- errors.add(I18n.t(source.class.to_s.demodulize.underscore, scope: 'spree'), "#{field_name} #{error}")
171
+ if Gem::Requirement.new(">= 6.1").satisfied_by?(Rails.gem_version)
172
+ source.errors.each do |error|
173
+ field_name = I18n.t("activerecord.attributes.#{source.class.to_s.underscore}.#{error.attribute}")
174
+ errors.add(I18n.t(source.class.to_s.demodulize.underscore, scope: 'spree'), "#{field_name} #{error.message}")
175
+ end
176
+ else
177
+ source.errors.each do |field, error|
178
+ field_name = I18n.t("activerecord.attributes.#{source.class.to_s.underscore}.#{field}")
179
+ errors.add(I18n.t(source.class.to_s.demodulize.underscore, scope: 'spree'), "#{field_name} #{error}")
180
+ end
174
181
  end
175
182
  end
176
183
  if errors.any?
@@ -366,8 +366,14 @@ module Spree
366
366
  # If the master is invalid, the Product object will be assigned its errors
367
367
  def validate_master
368
368
  unless master.valid?
369
- master.errors.each do |att, error|
370
- errors.add(att, error)
369
+ if Gem::Requirement.new(">= 6.1").satisfied_by?(Rails.gem_version)
370
+ master.errors.each do |error|
371
+ errors.add(error.attribute, error.message)
372
+ end
373
+ else
374
+ master.errors.each do |att, error|
375
+ errors.add(att, error)
376
+ end
371
377
  end
372
378
  end
373
379
  end
@@ -119,7 +119,7 @@ module Spree
119
119
 
120
120
  def at_least_one_shipping_category
121
121
  if shipping_categories.empty?
122
- errors[:base] << "You need to select at least one shipping category"
122
+ errors.add(:base, "You need to select at least one shipping category")
123
123
  end
124
124
  end
125
125
  end
@@ -11,10 +11,10 @@ module Spree
11
11
  display_name = variant.name.to_s
12
12
  display_name += %{ (#{variant.options_text})} unless variant.options_text.blank?
13
13
 
14
- line_item.errors[:quantity] << I18n.t(
14
+ line_item.errors.add(:quantity, I18n.t(
15
15
  'spree.selected_quantity_not_available',
16
16
  item: display_name.inspect
17
- )
17
+ ))
18
18
  false
19
19
  end
20
20
  end
@@ -5,10 +5,10 @@ module Spree
5
5
  class InventoryValidator < ActiveModel::Validator
6
6
  def validate(line_item)
7
7
  if line_item.inventory_units.count != line_item.quantity
8
- line_item.errors[:inventory] << I18n.t(
8
+ line_item.errors.add(:inventory, I18n.t(
9
9
  'spree.inventory_not_available',
10
10
  item: line_item.variant.name
11
- )
11
+ ))
12
12
  end
13
13
  end
14
14
  end
@@ -9,11 +9,10 @@ module Spree::Taxon::ActiveStorageAttachment
9
9
  styles: { mini: '32x32>', normal: '128x128>' },
10
10
  default_style: :mini
11
11
  validate :icon_is_an_image
12
-
13
-
14
12
  end
15
13
 
16
14
  def attachment_partial_name
15
+ Spree::Deprecation.warn("calling #attachment_partial_name on Spree::Taxon is deprecated without replacement.")
17
16
  'paperclip'
18
17
  end
19
18
  end
@@ -20,6 +20,7 @@ module Spree::Taxon::PaperclipAttachment
20
20
  end
21
21
 
22
22
  def attachment_partial_name
23
+ Spree::Deprecation.warn("calling #attachment_partial_name on Spree::Taxon is deprecated without replacement.")
23
24
  'paperclip'
24
25
  end
25
26
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddNameToSpreeAddresses < ActiveRecord::Migration[5.2]
4
+ def up
5
+ add_column :spree_addresses, :name, :string
6
+ add_index :spree_addresses, :name
7
+ end
8
+
9
+ def down
10
+ remove_index :spree_addresses, :name
11
+ remove_column :spree_addresses, :name
12
+ end
13
+ end
@@ -20,6 +20,9 @@ Dummy::Application.configure do
20
20
  # Raise exceptions instead of rendering exception templates
21
21
  config.action_dispatch.show_exceptions = false
22
22
 
23
+ # Disable request forgery protection in test environment
24
+ config.action_controller.allow_forgery_protection = false
25
+
23
26
  # Tell Action Mailer not to deliver emails to the real world.
24
27
  # The :test delivery method accumulates sent emails in the
25
28
  # ActionMailer::Base.deliveries array.
data/lib/spree/core.rb CHANGED
@@ -95,7 +95,3 @@ require 'spree/user_class_handle'
95
95
  require 'spree/preferences/store'
96
96
  require 'spree/preferences/static_model_preferences'
97
97
  require 'spree/preferences/scoped_store'
98
-
99
- if Rails.gem_version >= Gem::Version.new('6.1.0.alpha')
100
- require 'spree/awesome_nested_set_override'
101
- end
@@ -90,15 +90,14 @@ module Spree
90
90
  using the external validation class.
91
91
  DEPRECATION
92
92
  end
93
- end
94
93
 
95
- # Load in mailer previews for apps to use in development.
96
- # We need to make sure we call `Preview.all` before requiring our
97
- # previews, otherwise any previews the app attempts to add need to be
98
- # manually required.
99
- if Rails.env.development?
100
- initializer "spree.mailer_previews" do
94
+ # Load in mailer previews for apps to use in development.
95
+ # We need to make sure we call `Preview.all` before requiring our
96
+ # previews, otherwise any previews the app attempts to add need to be
97
+ # manually required.
98
+ if Rails.env.development? || Rails.env.test?
101
99
  ActionMailer::Preview.all
100
+
102
101
  Dir[root.join("lib/spree/mailer_previews/**/*_preview.rb")].each do |file|
103
102
  require_dependency file
104
103
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "2.11.4"
4
+ VERSION = "2.11.5"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION
@@ -1,40 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'spree/testing_support/factory_bot'
4
+
3
5
  module Spree
4
6
  module TestingSupport
5
- SEQUENCES = ["#{::Spree::Core::Engine.root}/lib/spree/testing_support/sequences.rb"]
6
- FACTORIES = Dir["#{::Spree::Core::Engine.root}/lib/spree/testing_support/factories/**/*_factory.rb"]
7
-
8
- def self.factory_bot_paths
9
- @paths ||= (SEQUENCES + FACTORIES).sort.map { |path| path.sub(/.rb\z/, '') }
10
- end
7
+ autoload :FactoryBot, "spree/testing_support/factory_bot"
11
8
 
12
- def self.deprecate_cherry_picking_factory_bot_files
13
- # All good if the factory is being loaded by FactoryBot.
14
- return if caller.find { |line| line.include? "/factory_bot/find_definitions.rb" }
9
+ autoload :SEQUENCES, "spree/testing_support/factory_bot"
10
+ autoload :FACTORIES, "spree/testing_support/factory_bot"
15
11
 
16
- Spree::Deprecation.warn(
17
- "Please do not cherry-pick factories, this is not well supported by FactoryBot. " \
18
- 'Use `require "spree/testing_support/factories"` instead.', caller(2)
19
- )
12
+ def factory_bot_paths
13
+ Spree::TestingSupport::FactoryBot.definition_file_paths
20
14
  end
21
15
 
22
- def self.load_all_factories
23
- require 'factory_bot'
24
- require 'factory_bot/version'
25
-
26
- requirement = Gem::Requirement.new("~> 4.8")
27
- version = Gem::Version.new(FactoryBot::VERSION)
28
-
29
- unless requirement.satisfied_by? version
30
- Spree::Deprecation.warn(
31
- "Please be aware that the supported version of FactoryBot is #{requirement}, " \
32
- "using version #{version} could lead to factory loading issues.", caller(2)
33
- )
34
- end
16
+ def check_factory_bot_version
17
+ Spree::TestingSupport::FactoryBot.check_version
18
+ end
35
19
 
36
- FactoryBot.definition_file_paths.concat(factory_bot_paths).uniq!
37
- FactoryBot.reload
20
+ def load_all_factories
21
+ Spree::TestingSupport::FactoryBot.add_paths_and_load!
38
22
  end
23
+
24
+ deprecate(
25
+ factory_bot_paths: "Spree::TestingSupport::FactoryBot.definition_file_paths",
26
+ check_factory_bot_version: "Spree::TestingSupport::FactoryBot.check_version",
27
+ load_all_factories: "Spree::TestingSupport::FactoryBot.add_paths_and_load!",
28
+ deprecator: Spree::Deprecator
29
+ )
39
30
  end
40
31
  end
@@ -16,6 +16,7 @@ RAILS_6_OR_ABOVE = Rails.gem_version >= Gem::Version.new('6.0')
16
16
 
17
17
  # @private
18
18
  class ApplicationController < ActionController::Base
19
+ protect_from_forgery with: :exception
19
20
  end
20
21
 
21
22
  # @private
@@ -51,8 +52,8 @@ module DummyApp
51
52
  config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
52
53
  config.whiny_nils = true
53
54
  config.consider_all_requests_local = true
54
- config.action_controller.allow_forgery_protection = true
55
- config.action_controller.default_protect_from_forgery = true
55
+ config.action_controller.allow_forgery_protection = false
56
+ config.action_controller.default_protect_from_forgery = false
56
57
  config.action_controller.perform_caching = false
57
58
  config.action_dispatch.show_exceptions = false
58
59
  config.active_support.deprecation = :stderr
@@ -61,6 +62,7 @@ module DummyApp
61
62
  config.secret_key_base = 'SECRET_TOKEN'
62
63
 
63
64
  config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob" if RAILS_6_OR_ABOVE
65
+ config.action_mailer.preview_path = File.expand_path('dummy_app/mailer_previews', __dir__)
64
66
  config.active_record.sqlite3.represent_boolean_as_integer = true unless RAILS_6_OR_ABOVE
65
67
 
66
68
  config.storage_path = Rails.root.join('tmp', 'storage')
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TestMailerPreview < ActionMailer::Preview
4
+ end
@@ -1,5 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/testing_support'
3
+ require 'spree/testing_support/factory_bot'
4
4
 
5
- Spree::TestingSupport.load_all_factories
5
+ Spree::Deprecation.warn(
6
+ "Please do not try to load factories directly. " \
7
+ 'Use factory_bot_rails and rely on the default configuration instead.', caller(1)
8
+ )
9
+
10
+ Spree::TestingSupport::FactoryBot.check_version
11
+ Spree::TestingSupport::FactoryBot::PATHS.each { |path| require path }
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/testing_support'
4
- Spree::TestingSupport.deprecate_cherry_picking_factory_bot_files
3
+ require 'spree/testing_support/factory_bot'
4
+ Spree::TestingSupport::FactoryBot.when_cherry_picked do
5
+ Spree::TestingSupport::FactoryBot.deprecate_cherry_picking
5
6
 
7
+ require 'spree/testing_support/factories/state_factory'
8
+ require 'spree/testing_support/factories/country_factory'
9
+ end
6
10
  FactoryBot.define do
7
11
  factory :address, class: 'Spree::Address' do
8
12
  transient do
@@ -1,7 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/testing_support'
4
- Spree::TestingSupport.deprecate_cherry_picking_factory_bot_files
3
+ require 'spree/testing_support/factory_bot'
4
+ Spree::TestingSupport::FactoryBot.when_cherry_picked do
5
+ Spree::TestingSupport::FactoryBot.deprecate_cherry_picking
6
+
7
+ require 'spree/testing_support/factories/line_item_factory'
8
+ require 'spree/testing_support/factories/order_factory'
9
+ require 'spree/testing_support/factories/tax_category_factory'
10
+ require 'spree/testing_support/factories/tax_rate_factory'
11
+ require 'spree/testing_support/factories/zone_factory'
12
+ end
5
13
 
6
14
  FactoryBot.define do
7
15
  factory :adjustment, class: 'Spree::Adjustment' do
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/testing_support'
4
- Spree::TestingSupport.deprecate_cherry_picking_factory_bot_files
3
+ require 'spree/testing_support/factory_bot'
4
+ Spree::TestingSupport::FactoryBot.when_cherry_picked do
5
+ Spree::TestingSupport::FactoryBot.deprecate_cherry_picking
6
+ end
5
7
 
6
8
  FactoryBot.define do
7
9
  factory :adjustment_reason, class: 'Spree::AdjustmentReason' do
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/testing_support'
4
- Spree::TestingSupport.deprecate_cherry_picking_factory_bot_files
3
+ require 'spree/testing_support/factory_bot'
4
+ Spree::TestingSupport::FactoryBot.when_cherry_picked do
5
+ Spree::TestingSupport::FactoryBot.deprecate_cherry_picking
6
+ end
5
7
 
6
8
  FactoryBot.define do
7
9
  factory :calculator, aliases: [:flat_rate_calculator], class: 'Spree::Calculator::FlatRate' do
@@ -1,7 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/testing_support'
4
- Spree::TestingSupport.deprecate_cherry_picking_factory_bot_files
3
+ require 'spree/testing_support/factory_bot'
4
+ Spree::TestingSupport::FactoryBot.when_cherry_picked do
5
+ Spree::TestingSupport::FactoryBot.deprecate_cherry_picking
6
+
7
+ require 'spree/testing_support/factories/shipment_factory'
8
+ require 'spree/testing_support/factories/inventory_unit_factory'
9
+ end
5
10
 
6
11
  FactoryBot.define do
7
12
  factory :carton, class: 'Spree::Carton' do
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/testing_support'
4
- Spree::TestingSupport.deprecate_cherry_picking_factory_bot_files
3
+ require 'spree/testing_support/factory_bot'
4
+ Spree::TestingSupport::FactoryBot.when_cherry_picked do
5
+ Spree::TestingSupport::FactoryBot.deprecate_cherry_picking
6
+ end
5
7
 
6
8
  require 'carmen'
7
9