spree_core 5.3.2 → 5.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/spree/invitation.rb +1 -1
- data/app/models/spree/product/slugs.rb +1 -1
- data/app/models/spree/store_product.rb +2 -0
- data/app/models/spree/variant.rb +19 -17
- data/app/services/spree/data_feeds/google/rss.rb +3 -1
- data/app/views/spree/addresses/_form.html.erb +1 -2
- data/lib/generators/spree/dummy/templates/rails/database.yml +6 -6
- data/lib/spree/core/controller_helpers/auth.rb +2 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/common_rake.rb +53 -0
- data/lib/spree/testing_support/factories/calculator_factory.rb +4 -4
- data/lib/spree/testing_support/factories/custom_domain_factory.rb +1 -1
- data/lib/spree/testing_support/factories/customer_group_user_factory.rb +1 -1
- data/lib/spree/testing_support/factories/export_factory.rb +2 -2
- data/lib/spree/testing_support/factories/google_data_feed_factory.rb +1 -2
- data/lib/spree/testing_support/factories/import_factory.rb +1 -1
- data/lib/spree/testing_support/factories/invitation_factory.rb +1 -1
- data/lib/spree/testing_support/factories/line_item_factory.rb +11 -6
- data/lib/spree/testing_support/factories/order_factory.rb +5 -5
- data/lib/spree/testing_support/factories/payment_factory.rb +1 -1
- data/lib/spree/testing_support/factories/post_factory.rb +3 -3
- data/lib/spree/testing_support/factories/product_factory.rb +6 -3
- data/lib/spree/testing_support/factories/product_property_factory.rb +1 -1
- data/lib/spree/testing_support/factories/prototype_factory.rb +3 -3
- data/lib/spree/testing_support/factories/report_factory.rb +4 -4
- data/lib/spree/testing_support/factories/store_credit_event_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_credit_factory.rb +3 -3
- data/lib/spree/testing_support/factories/user_factory.rb +3 -5
- data/lib/spree/testing_support/factories/variant_factory.rb +3 -4
- data/lib/spree/testing_support/factories/zone_factory.rb +8 -5
- data/lib/spree/testing_support/factories.rb +1 -1
- data/lib/spree/testing_support/store.rb +1 -5
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b1ea480e8607e801d3c45d8decf522c829003eb3fa6c1f8f92b9185a4bfefec
|
|
4
|
+
data.tar.gz: 552fb0686b6da4a560dd47144d52079d1ab73c270a9e4c9093e62b9e556ef74f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ed2cab50fb7c122df6565b931324ea7ba307c8580a98ac8f9e2e400140df75092ed417db47311a6d3ec01985a6696cfbce1d3e3fa7917c329646b13ef51b095
|
|
7
|
+
data.tar.gz: 34bd9929ed9e4a962696b2be41a5bb0da2c330fd12d1cbff89e34fa78cdceaa84d6b58cb7ae321d1868864c2888eccd752cd0bef7dbd9cd473aa68490619c2f6
|
|
@@ -54,7 +54,7 @@ module Spree
|
|
|
54
54
|
#
|
|
55
55
|
after_initialize :set_defaults, if: :new_record?
|
|
56
56
|
before_validation :set_invitee_from_email, on: :create
|
|
57
|
-
|
|
57
|
+
after_commit :publish_invitation_created_event, on: :create, unless: :skip_email
|
|
58
58
|
|
|
59
59
|
# returns the store for the invitation
|
|
60
60
|
# if the resource is a store, return the resource
|
|
@@ -103,7 +103,7 @@ module Spree
|
|
|
103
103
|
translations.with_deleted.each { |rec| rec.update_columns(slug: new_slug.call(rec)) }
|
|
104
104
|
slugs.with_deleted.each { |rec| rec.update_column(:slug, new_slug.call(rec)) }
|
|
105
105
|
|
|
106
|
-
translations.find_by
|
|
106
|
+
translations.find_by(locale: I18n.locale)&.update_column(:slug, slug) if Spree.use_translations?
|
|
107
107
|
end
|
|
108
108
|
end
|
|
109
109
|
end
|
|
@@ -9,6 +9,8 @@ module Spree
|
|
|
9
9
|
validates :store_id, uniqueness: { scope: :product_id }
|
|
10
10
|
|
|
11
11
|
def refresh_metrics!
|
|
12
|
+
return if product.nil?
|
|
13
|
+
|
|
12
14
|
completed_order_ids = product.completed_orders.where(store_id: store_id).select(:id)
|
|
13
15
|
variant_ids = product.variants_including_master.ids
|
|
14
16
|
|
data/app/models/spree/variant.rb
CHANGED
|
@@ -91,36 +91,33 @@ module Spree
|
|
|
91
91
|
scope :backorderable, -> { left_joins(:stock_items).where(spree_stock_items: { backorderable: true }) }
|
|
92
92
|
scope :in_stock_or_backorderable, -> { in_stock.or(backorderable) }
|
|
93
93
|
|
|
94
|
-
scope :eligible,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
select(:product_id).
|
|
99
|
-
group(:product_id).
|
|
100
|
-
having("COUNT(#{Spree::Variant.table_name}.id) = 1")
|
|
94
|
+
scope :eligible, lambda {
|
|
95
|
+
joins(:product).where(
|
|
96
|
+
arel_table[:is_master].eq(false).or(
|
|
97
|
+
Spree::Product.arel_table[:variant_count].eq(0)
|
|
101
98
|
)
|
|
102
99
|
)
|
|
103
100
|
}
|
|
104
101
|
|
|
105
|
-
scope :not_discontinued,
|
|
102
|
+
scope :not_discontinued, lambda {
|
|
106
103
|
where(
|
|
107
104
|
arel_table[:discontinue_on].eq(nil).or(
|
|
108
105
|
arel_table[:discontinue_on].gteq(Time.current)
|
|
109
106
|
)
|
|
110
107
|
)
|
|
111
|
-
|
|
108
|
+
}
|
|
112
109
|
|
|
113
110
|
scope :not_deleted, -> { where("#{Spree::Variant.quoted_table_name}.deleted_at IS NULL") }
|
|
114
111
|
|
|
115
|
-
scope :for_currency_and_available_price_amount,
|
|
112
|
+
scope :for_currency_and_available_price_amount, lambda { |currency = nil|
|
|
116
113
|
currency ||= Spree::Store.default.default_currency
|
|
117
114
|
joins(:prices).where("#{Spree::Price.table_name}.currency = ?", currency).where("#{Spree::Price.table_name}.amount IS NOT NULL").distinct
|
|
118
|
-
|
|
115
|
+
}
|
|
119
116
|
|
|
120
|
-
scope :active,
|
|
117
|
+
scope :active, lambda { |currency = nil|
|
|
121
118
|
not_discontinued.not_deleted.
|
|
122
119
|
for_currency_and_available_price_amount(currency)
|
|
123
|
-
|
|
120
|
+
}
|
|
124
121
|
|
|
125
122
|
scope :with_option_value, lambda { |option_name, option_value|
|
|
126
123
|
option_type_ids = OptionType.where(name: option_name).ids
|
|
@@ -187,7 +184,8 @@ module Spree
|
|
|
187
184
|
)
|
|
188
185
|
|
|
189
186
|
self.whitelisted_ransackable_associations = %w[option_values product tax_category prices default_price]
|
|
190
|
-
self.whitelisted_ransackable_attributes = %w[weight depth width height sku discontinue_on is_master cost_price cost_currency track_inventory
|
|
187
|
+
self.whitelisted_ransackable_attributes = %w[weight depth width height sku discontinue_on is_master cost_price cost_currency track_inventory
|
|
188
|
+
deleted_at]
|
|
191
189
|
self.whitelisted_ransackable_scopes = %i(product_name_or_sku_cont search_by_product_name_or_sku)
|
|
192
190
|
|
|
193
191
|
def self.product_name_or_sku_cont(query)
|
|
@@ -258,9 +256,13 @@ module Spree
|
|
|
258
256
|
# @return [String] the options text of the variant
|
|
259
257
|
def options_text
|
|
260
258
|
@options_text ||= if option_values.loaded?
|
|
261
|
-
option_values.sort_by
|
|
259
|
+
option_values.sort_by do |ov|
|
|
260
|
+
ov.option_type.position
|
|
261
|
+
end.map { |ov| "#{ov.option_type.presentation}: #{ov.presentation}" }.to_sentence(words_connector: ', ', two_words_connector: ', ')
|
|
262
262
|
else
|
|
263
|
-
option_values.includes(:option_type).joins(:option_type).order("#{Spree::OptionType.table_name}.position").map
|
|
263
|
+
option_values.includes(:option_type).joins(:option_type).order("#{Spree::OptionType.table_name}.position").map do |ov|
|
|
264
|
+
"#{ov.option_type.presentation}: #{ov.presentation}"
|
|
265
|
+
end.to_sentence(words_connector: ', ', two_words_connector: ', ')
|
|
264
266
|
end
|
|
265
267
|
end
|
|
266
268
|
|
|
@@ -273,7 +275,7 @@ module Spree
|
|
|
273
275
|
# Returns the descriptive name of the variant.
|
|
274
276
|
# @return [String] the descriptive name of the variant
|
|
275
277
|
def descriptive_name
|
|
276
|
-
is_master? ? name
|
|
278
|
+
is_master? ? "#{name} - Master" : "#{name} - #{options_text}"
|
|
277
279
|
end
|
|
278
280
|
|
|
279
281
|
# use deleted? rather than checking the attribute directly. this
|
|
@@ -18,7 +18,9 @@ module Spree
|
|
|
18
18
|
result = products_list.call(store)
|
|
19
19
|
if result.success?
|
|
20
20
|
result.value[:products].find_each do |product|
|
|
21
|
-
product.
|
|
21
|
+
product.variants_including_master.active.find_each do |variant|
|
|
22
|
+
next if variant.is_master? && product.has_variants?
|
|
23
|
+
|
|
22
24
|
add_variant_information_to_xml(xml, product, variant)
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -45,8 +45,7 @@
|
|
|
45
45
|
</div>
|
|
46
46
|
<%= render "spree/addresses/suggestions_box" %>
|
|
47
47
|
</div>
|
|
48
|
-
<span class="text-sm space-x-2
|
|
49
|
-
<%= heroicon "exclamation-circle", variant: :outline if defined?(heroicon) %>
|
|
48
|
+
<span class="text-sm space-x-2 hidden alert alert-info mt-2 static" data-address-autocomplete-target="addressWarning">
|
|
50
49
|
<%= Spree.t('address_book.add_house_number') %>
|
|
51
50
|
</span>
|
|
52
51
|
</div>
|
|
@@ -14,7 +14,7 @@ development:
|
|
|
14
14
|
database: db/spree_development.sqlite3
|
|
15
15
|
test:
|
|
16
16
|
adapter: sqlite3
|
|
17
|
-
database: db/spree_test
|
|
17
|
+
database: db/spree_test<%%= ENV['TEST_ENV_NUMBER'] %>.sqlite3
|
|
18
18
|
timeout: 10000
|
|
19
19
|
production:
|
|
20
20
|
adapter: sqlite3
|
|
@@ -40,7 +40,7 @@ development:
|
|
|
40
40
|
database: <%= database_prefix %><%= lib_name %>_spree_development
|
|
41
41
|
test:
|
|
42
42
|
<<: *mysql
|
|
43
|
-
database: <%= database_prefix %><%= lib_name %>_spree_test
|
|
43
|
+
database: <%= database_prefix %><%= lib_name %>_spree_test<%%= ENV['TEST_ENV_NUMBER'] %>
|
|
44
44
|
production:
|
|
45
45
|
<<: *mysql
|
|
46
46
|
database: <%= database_prefix %><%= lib_name %>_spree_production
|
|
@@ -57,14 +57,14 @@ postgres: &postgres
|
|
|
57
57
|
host: <%= db_host %>
|
|
58
58
|
<% end %>
|
|
59
59
|
min_messages: warning
|
|
60
|
-
pool:
|
|
60
|
+
pool: <%%= ENV.fetch("DB_POOL", 50) %>
|
|
61
61
|
|
|
62
62
|
development:
|
|
63
63
|
<<: *postgres
|
|
64
64
|
database: <%= database_prefix %><%= lib_name %>_spree_development
|
|
65
65
|
test:
|
|
66
66
|
<<: *postgres
|
|
67
|
-
database: <%= database_prefix %><%= lib_name %>_spree_test
|
|
67
|
+
database: <%= database_prefix %><%= lib_name %>_spree_test<%%= ENV['TEST_ENV_NUMBER'] %>
|
|
68
68
|
production:
|
|
69
69
|
<<: *postgres
|
|
70
70
|
database: <%= database_prefix %><%= lib_name %>_spree_production
|
|
@@ -74,8 +74,8 @@ development:
|
|
|
74
74
|
database: db/spree_development.sqlite3
|
|
75
75
|
test:
|
|
76
76
|
adapter: sqlite3
|
|
77
|
-
database: db/spree_test
|
|
77
|
+
database: db/spree_test<%%= ENV['TEST_ENV_NUMBER'] %>.sqlite3
|
|
78
78
|
production:
|
|
79
79
|
adapter: sqlite3
|
|
80
80
|
database: db/spree_production.sqlite3
|
|
81
|
-
<% end %>
|
|
81
|
+
<% end %>
|
|
@@ -21,6 +21,8 @@ module Spree
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def current_oauth_token
|
|
24
|
+
Spree::Deprecation.warn('Spree::Current.oauth_token is deprecated and will be removed in Spree 5.5')
|
|
25
|
+
|
|
24
26
|
get_last_access_token = ->(user) { Spree::OauthAccessToken.active_for(user).where(expires_in: nil).last }
|
|
25
27
|
create_access_token = ->(user) { Spree::OauthAccessToken.create!(resource_owner: user) }
|
|
26
28
|
user = try_spree_current_user
|
data/lib/spree/core/version.rb
CHANGED
|
@@ -134,3 +134,56 @@ namespace :common do
|
|
|
134
134
|
system('bundle exec rake db:seed RAILS_ENV=test > /dev/null 2>&1')
|
|
135
135
|
end
|
|
136
136
|
end
|
|
137
|
+
|
|
138
|
+
# Custom parallel setup task instead of parallel_tests' native parallel:create/parallel:prepare
|
|
139
|
+
# because Spree gems are not Rails apps — the Rails app lives in spec/dummy/ and db: rake tasks
|
|
140
|
+
# are not available from the gem directory. For SQLite, we copy the primary .sqlite3 file which
|
|
141
|
+
# is faster than creating + migrating N databases through Rails.
|
|
142
|
+
desc 'Create and prepare databases for parallel test workers'
|
|
143
|
+
task :parallel_setup, [:count] do |_t, args|
|
|
144
|
+
require 'parallel'
|
|
145
|
+
|
|
146
|
+
count = (args[:count] || ENV.fetch('PARALLEL_TEST_PROCESSORS', Parallel.processor_count)).to_i
|
|
147
|
+
dummy_path = ENV['DUMMY_PATH'] || 'spec/dummy'
|
|
148
|
+
db_config_path = File.join(dummy_path, 'config', 'database.yml')
|
|
149
|
+
|
|
150
|
+
raise "Database config not found at #{db_config_path}. Run 'rake test_app' first." unless File.exist?(db_config_path)
|
|
151
|
+
|
|
152
|
+
require 'erb'
|
|
153
|
+
require 'yaml'
|
|
154
|
+
|
|
155
|
+
db_config = YAML.safe_load(ERB.new(File.read(db_config_path)).result, permitted_classes: [Symbol])
|
|
156
|
+
adapter = db_config.dig('test', 'adapter')
|
|
157
|
+
|
|
158
|
+
if adapter == 'sqlite3'
|
|
159
|
+
# For SQLite, copy the primary test database for each worker
|
|
160
|
+
primary_db = File.join(dummy_path, db_config.dig('test', 'database'))
|
|
161
|
+
|
|
162
|
+
raise "Primary test database not found at #{primary_db}. Run 'rake test_app' first." unless File.exist?(primary_db)
|
|
163
|
+
|
|
164
|
+
2.upto(count) do |i|
|
|
165
|
+
worker_db = primary_db.sub(/\.sqlite3$/, "#{i}.sqlite3")
|
|
166
|
+
FileUtils.cp(primary_db, worker_db)
|
|
167
|
+
puts "Created parallel database: #{worker_db}"
|
|
168
|
+
end
|
|
169
|
+
else
|
|
170
|
+
# For PostgreSQL/MySQL, create and migrate each worker's database
|
|
171
|
+
2.upto(count) do |i|
|
|
172
|
+
env_vars = "TEST_ENV_NUMBER=#{i} RAILS_ENV=test"
|
|
173
|
+
puts "Setting up database for worker #{i}..."
|
|
174
|
+
Dir.chdir(dummy_path) do
|
|
175
|
+
system("#{env_vars} bundle exec rake db:create db:migrate") || raise("Failed to setup database for worker #{i}")
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
puts "Parallel databases setup complete (#{count} workers)"
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
desc 'Run specs in parallel'
|
|
184
|
+
task :parallel_spec, [:count] do |_t, args|
|
|
185
|
+
count = args[:count] || ENV.fetch('PARALLEL_TEST_PROCESSORS', nil)
|
|
186
|
+
count_arg = count ? "-n #{count}" : ''
|
|
187
|
+
success = system("bundle exec parallel_rspec #{count_arg} spec")
|
|
188
|
+
exit(success ? 0 : 1)
|
|
189
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
2
|
factory :calculator, class: Spree::Calculator::FlatRate do
|
|
3
|
-
|
|
3
|
+
preferred_amount { 10.0 }
|
|
4
4
|
end
|
|
5
5
|
|
|
6
6
|
factory :no_amount_calculator, class: Spree::Calculator::FlatRate do
|
|
7
|
-
|
|
7
|
+
preferred_amount { 0 }
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
factory :default_tax_calculator, class: Spree::Calculator::DefaultTax do
|
|
@@ -27,10 +27,10 @@ FactoryBot.define do
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
factory :non_free_shipping_calculator, class: Spree::Calculator::Shipping::FlatRate do
|
|
30
|
-
|
|
30
|
+
preferred_amount { 20.0 }
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
factory :digital_shipping_calculator, class: Spree::Calculator::Shipping::DigitalDelivery do
|
|
34
|
-
|
|
34
|
+
preferred_amount { 0 }
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
2
|
factory :import, class: 'Spree::Import' do
|
|
3
3
|
owner { Spree::Store.default || create(:store) }
|
|
4
|
-
user
|
|
4
|
+
association :user, factory: :admin_user
|
|
5
5
|
type { 'Spree::Imports::Products' }
|
|
6
6
|
|
|
7
7
|
factory :product_import, class: 'Spree::Imports::Products', parent: :import do
|
|
@@ -4,13 +4,18 @@ FactoryBot.define do
|
|
|
4
4
|
quantity { 1 }
|
|
5
5
|
price { BigDecimal('10.00') }
|
|
6
6
|
currency { order.currency }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
transient do
|
|
8
|
+
product { nil }
|
|
9
|
+
end
|
|
10
|
+
variant do
|
|
11
|
+
resolved_product = product || begin
|
|
12
|
+
if order&.store&.present?
|
|
13
|
+
create(:product, stores: [order.store])
|
|
14
|
+
else
|
|
15
|
+
create(:product)
|
|
16
|
+
end
|
|
12
17
|
end
|
|
18
|
+
resolved_product.master
|
|
13
19
|
end
|
|
14
|
-
variant { product.master }
|
|
15
20
|
end
|
|
16
21
|
end
|
|
@@ -13,10 +13,11 @@ FactoryBot.define do
|
|
|
13
13
|
|
|
14
14
|
before(:create) do |order|
|
|
15
15
|
unless order.store.present?
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
store = begin
|
|
17
|
+
default = Spree::Store.default
|
|
18
|
+
default&.persisted? ? default : nil
|
|
19
|
+
end
|
|
20
|
+
order.store = store || create(:store)
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
|
|
@@ -42,7 +43,6 @@ FactoryBot.define do
|
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
factory :order_with_line_items do
|
|
45
|
-
bill_address
|
|
46
46
|
ship_address
|
|
47
47
|
|
|
48
48
|
transient do
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
2
|
factory :post, class: Spree::Post do
|
|
3
|
-
|
|
3
|
+
store { Spree::Store.default || create(:store) }
|
|
4
|
+
post_category { association(:post_category, store: store) }
|
|
4
5
|
title { FFaker::Lorem.sentence }
|
|
5
6
|
content { FFaker::Lorem.paragraph }
|
|
6
7
|
published_at { Time.current }
|
|
7
|
-
author
|
|
8
|
-
store { Spree::Store.default || create(:store) }
|
|
8
|
+
association :author, factory: :admin_user
|
|
9
9
|
|
|
10
10
|
trait :with_image do
|
|
11
11
|
image { Rack::Test::UploadedFile.new(Spree::Core::Engine.root.join('spec/fixtures/thinking-cat.jpg'), 'image/jpeg') }
|
|
@@ -19,7 +19,10 @@ FactoryBot.define do
|
|
|
19
19
|
create(:store, default: true) unless Spree::Store.any?
|
|
20
20
|
end
|
|
21
21
|
after(:create) do |product|
|
|
22
|
-
|
|
22
|
+
existing_location_ids = product.master.stock_items.pluck(:stock_location_id)
|
|
23
|
+
Spree::StockLocation.where.not(id: existing_location_ids).find_each do |stock_location|
|
|
24
|
+
stock_location.propagate_variant(product.master)
|
|
25
|
+
end
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
factory :custom_product do
|
|
@@ -49,8 +52,8 @@ FactoryBot.define do
|
|
|
49
52
|
end
|
|
50
53
|
factory :product_with_properties do
|
|
51
54
|
after(:create) do |product|
|
|
52
|
-
create(:property, :brand
|
|
53
|
-
create(:product_property, product: product,
|
|
55
|
+
property = create(:property, :brand)
|
|
56
|
+
create(:product_property, product: product, property: property, value: 'Epsilon')
|
|
54
57
|
end
|
|
55
58
|
end
|
|
56
59
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
2
|
factory :prototype, class: Spree::Prototype do
|
|
3
3
|
name { 'Baseball Cap' }
|
|
4
|
-
properties { [
|
|
4
|
+
properties { [build(:property)] }
|
|
5
5
|
end
|
|
6
6
|
factory :prototype_with_option_types, class: Spree::Prototype do
|
|
7
7
|
name { 'Baseball Cap' }
|
|
8
|
-
properties { [
|
|
9
|
-
option_types { [
|
|
8
|
+
properties { [build(:property)] }
|
|
9
|
+
option_types { [build(:option_type)] }
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
#
|
|
15
15
|
FactoryBot.define do
|
|
16
16
|
factory :report, class: 'Spree::Reports::SalesTotal' do
|
|
17
|
-
store
|
|
18
|
-
user
|
|
17
|
+
association :store, factory: :store
|
|
18
|
+
association :user, factory: :admin_user
|
|
19
19
|
type { 'Spree::Reports::SalesTotal' }
|
|
20
20
|
currency { 'USD' }
|
|
21
21
|
date_from { 1.month.ago }
|
|
@@ -23,8 +23,8 @@ FactoryBot.define do
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
factory :products_performance_report, class: 'Spree::Reports::ProductsPerformance' do
|
|
26
|
-
store
|
|
27
|
-
user
|
|
26
|
+
association :store, factory: :store
|
|
27
|
+
association :user, factory: :admin_user
|
|
28
28
|
type { 'Spree::Reports::ProductsPerformance' }
|
|
29
29
|
currency { 'USD' }
|
|
30
30
|
date_from { 1.month.ago }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
2
|
factory :store_credit_auth_event, class: Spree::StoreCreditEvent do
|
|
3
|
-
store_credit
|
|
3
|
+
association :store_credit, factory: :store_credit
|
|
4
4
|
action { Spree::StoreCredit::AUTHORIZE_ACTION }
|
|
5
5
|
amount { 100.00 }
|
|
6
6
|
authorization_code { "#{store_credit.id}-SC-20140602164814476128" }
|
|
@@ -3,11 +3,11 @@ FactoryBot.define do
|
|
|
3
3
|
|
|
4
4
|
factory :store_credit, class: Spree::StoreCredit do
|
|
5
5
|
user
|
|
6
|
-
created_by
|
|
7
|
-
category
|
|
6
|
+
association :created_by, factory: :admin_user
|
|
7
|
+
association :category, factory: :store_credit_category
|
|
8
8
|
amount { 150.00 }
|
|
9
9
|
currency { 'USD' }
|
|
10
|
-
credit_type
|
|
10
|
+
association :credit_type, factory: :primary_credit_type
|
|
11
11
|
store { Spree::Store.default || create(:store) }
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -13,11 +13,9 @@ FactoryBot.define do
|
|
|
13
13
|
|
|
14
14
|
factory :user_with_addresses, aliases: [:user_with_addreses] do
|
|
15
15
|
after(:create) do |user|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
user.
|
|
19
|
-
user.addresses << user.bill_address
|
|
20
|
-
user.save
|
|
16
|
+
ship_address = create(:address, user: user)
|
|
17
|
+
bill_address = create(:address, user: user)
|
|
18
|
+
user.update_columns(ship_address_id: ship_address.id, bill_address_id: bill_address.id)
|
|
21
19
|
end
|
|
22
20
|
end
|
|
23
21
|
end
|
|
@@ -13,7 +13,7 @@ FactoryBot.define do
|
|
|
13
13
|
track_inventory { true }
|
|
14
14
|
|
|
15
15
|
product { |p| p.association(:base_product, stores: [Spree::Store.default]) }
|
|
16
|
-
option_values { [
|
|
16
|
+
option_values { [build(:option_value)] }
|
|
17
17
|
|
|
18
18
|
transient do
|
|
19
19
|
create_stock { true }
|
|
@@ -26,9 +26,8 @@ FactoryBot.define do
|
|
|
26
26
|
|
|
27
27
|
after(:create) do |variant, evaluator|
|
|
28
28
|
if evaluator.create_stock
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
existing_location_ids = variant.stock_items.pluck(:stock_location_id)
|
|
30
|
+
Spree::StockLocation.where.not(id: existing_location_ids).find_each do |stock_location|
|
|
32
31
|
stock_location.propagate_variant(variant)
|
|
33
32
|
end
|
|
34
33
|
end
|
|
@@ -13,13 +13,16 @@ FactoryBot.define do
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
factory :global_zone, class: Spree::Zone do
|
|
16
|
-
|
|
16
|
+
name { 'GlobalZone' }
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
after(:create) do |zone|
|
|
19
|
+
country_ids = Spree::Country.pluck(:id)
|
|
20
|
+
existing_ids = zone.zone_members.where(zoneable_type: 'Spree::Country').pluck(:zoneable_id)
|
|
21
|
+
new_ids = country_ids - existing_ids
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
Spree::
|
|
23
|
+
if new_ids.any?
|
|
24
|
+
records = new_ids.map { |id| { zoneable_type: 'Spree::Country', zoneable_id: id, zone_id: zone.id, created_at: Time.current, updated_at: Time.current } }
|
|
25
|
+
Spree::ZoneMember.insert_all(records)
|
|
23
26
|
end
|
|
24
27
|
end
|
|
25
28
|
end
|
|
@@ -34,10 +34,6 @@ RSpec.configure do |config|
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
config.after(:all) do
|
|
37
|
-
|
|
38
|
-
DatabaseCleaner.strategy = :transaction
|
|
39
|
-
DatabaseCleaner.clean_with(:truncation)
|
|
40
|
-
clear_enqueued_jobs
|
|
41
|
-
end
|
|
37
|
+
clear_enqueued_jobs
|
|
42
38
|
end
|
|
43
39
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.3.
|
|
4
|
+
version: 5.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Schofield
|
|
@@ -1717,9 +1717,9 @@ licenses:
|
|
|
1717
1717
|
- BSD-3-Clause
|
|
1718
1718
|
metadata:
|
|
1719
1719
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
1720
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.
|
|
1720
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.4
|
|
1721
1721
|
documentation_uri: https://docs.spreecommerce.org/
|
|
1722
|
-
source_code_uri: https://github.com/spree/spree/tree/v5.3.
|
|
1722
|
+
source_code_uri: https://github.com/spree/spree/tree/v5.3.4
|
|
1723
1723
|
rdoc_options: []
|
|
1724
1724
|
require_paths:
|
|
1725
1725
|
- lib
|