solidus_core 2.9.6 → 2.10.0.beta1
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/concerns/spree/user_address_book.rb +2 -2
- data/app/models/spree/address.rb +2 -2
- data/app/models/spree/adjustment.rb +9 -9
- data/app/models/spree/asset.rb +1 -1
- data/app/models/spree/base.rb +0 -2
- data/app/models/spree/calculator.rb +1 -1
- data/app/models/spree/carton.rb +3 -3
- data/app/models/spree/classification.rb +2 -2
- data/app/models/spree/credit_card.rb +2 -2
- data/app/models/spree/customer_return.rb +1 -1
- data/app/models/spree/image/paperclip_attachment.rb +1 -1
- data/app/models/spree/inventory_unit.rb +4 -4
- data/app/models/spree/line_item.rb +3 -3
- data/app/models/spree/line_item_action.rb +2 -2
- data/app/models/spree/log_entry.rb +1 -1
- data/app/models/spree/option_value.rb +1 -1
- data/app/models/spree/option_values_variant.rb +2 -2
- data/app/models/spree/order.rb +8 -25
- data/app/models/spree/order_cancellations.rb +1 -1
- data/app/models/spree/order_contents.rb +2 -2
- data/app/models/spree/order_mutex.rb +1 -1
- data/app/models/spree/order_promotion.rb +3 -3
- data/app/models/spree/order_shipping.rb +1 -1
- data/app/models/spree/order_taxation.rb +1 -1
- data/app/models/spree/payment/processing.rb +1 -1
- data/app/models/spree/payment.rb +4 -4
- data/app/models/spree/payment_capture_event.rb +1 -1
- data/app/models/spree/payment_method/bogus_credit_card.rb +1 -1
- data/app/models/spree/payment_method.rb +3 -0
- data/app/models/spree/payment_source.rb +1 -1
- data/app/models/spree/price.rb +2 -2
- data/app/models/spree/product/scopes.rb +217 -210
- data/app/models/spree/product.rb +2 -2
- data/app/models/spree/product_option_type.rb +2 -2
- data/app/models/spree/product_promotion_rule.rb +2 -2
- data/app/models/spree/product_property.rb +2 -2
- data/app/models/spree/promotion.rb +1 -1
- data/app/models/spree/promotion_action.rb +1 -1
- data/app/models/spree/promotion_code.rb +2 -2
- data/app/models/spree/promotion_code_batch.rb +1 -1
- data/app/models/spree/promotion_rule.rb +1 -1
- data/app/models/spree/promotion_rule_role.rb +2 -2
- data/app/models/spree/promotion_rule_store.rb +2 -2
- data/app/models/spree/promotion_rule_taxon.rb +2 -2
- data/app/models/spree/promotion_rule_user.rb +2 -2
- data/app/models/spree/refund.rb +3 -3
- data/app/models/spree/reimbursement/credit.rb +2 -2
- data/app/models/spree/reimbursement.rb +2 -2
- data/app/models/spree/reimbursement_tax_calculator.rb +1 -1
- data/app/models/spree/return_authorization.rb +3 -3
- data/app/models/spree/return_item.rb +10 -10
- data/app/models/spree/role_user.rb +2 -2
- data/app/models/spree/shipment.rb +3 -3
- data/app/models/spree/shipping_manifest.rb +3 -3
- data/app/models/spree/shipping_method.rb +1 -1
- data/app/models/spree/shipping_method_category.rb +2 -2
- data/app/models/spree/shipping_method_stock_location.rb +2 -2
- data/app/models/spree/shipping_method_zone.rb +2 -2
- data/app/models/spree/shipping_rate.rb +2 -2
- data/app/models/spree/shipping_rate_tax.rb +2 -2
- data/app/models/spree/state.rb +1 -1
- data/app/models/spree/state_change.rb +2 -2
- data/app/models/spree/stock_item.rb +2 -2
- data/app/models/spree/stock_location.rb +2 -2
- data/app/models/spree/stock_movement.rb +2 -2
- data/app/models/spree/store_credit.rb +8 -8
- data/app/models/spree/store_credit_event.rb +3 -3
- data/app/models/spree/store_payment_method.rb +2 -2
- data/app/models/spree/store_shipping_method.rb +2 -2
- data/app/models/spree/tax_rate.rb +1 -1
- data/app/models/spree/tax_rate_tax_category.rb +2 -2
- data/app/models/spree/unit_cancel.rb +5 -2
- data/app/models/spree/user_address.rb +2 -2
- data/app/models/spree/user_stock_location.rb +2 -2
- data/app/models/spree/variant/scopes.rb +37 -29
- data/app/models/spree/variant.rb +1 -1
- data/app/models/spree/variant_property_rule.rb +1 -1
- data/app/models/spree/variant_property_rule_condition.rb +2 -2
- data/app/models/spree/variant_property_rule_value.rb +2 -2
- data/app/models/spree/wallet_payment_source.rb +2 -2
- data/app/models/spree/zone_member.rb +2 -2
- data/config/initializers/inflections.rb +5 -0
- data/config/locales/en.yml +22 -3
- data/lib/generators/spree/dummy/dummy_generator.rb +2 -0
- data/lib/generators/spree/install/install_generator.rb +0 -3
- data/lib/spree/core/controller_helpers/strong_parameters.rb +7 -21
- data/lib/spree/core/environment_extension.rb +0 -9
- data/lib/spree/core/importer/order.rb +3 -4
- data/lib/spree/core/importer/product.rb +2 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/permission_sets/default_customer.rb +1 -1
- data/lib/spree/permitted_attributes.rb +6 -75
- data/lib/spree/testing_support/dummy_app/rake_tasks.rb +6 -2
- data/solidus_core.gemspec +4 -4
- data/spec/lib/search/base_spec.rb +5 -1
- data/spec/lib/search/variant_spec.rb +1 -1
- data/spec/lib/spree/core/controller_helpers/strong_parameters_spec.rb +1 -8
- data/spec/lib/spree/core/environment_extension_spec.rb +1 -12
- data/spec/lib/spree/event_spec.rb +15 -3
- data/spec/migrate/20190106184413_remove_code_from_spree_promotions_spec.rb +18 -4
- data/spec/models/spree/calculator/refunds/default_refund_amount_spec.rb +1 -1
- data/spec/models/spree/carton_spec.rb +2 -2
- data/spec/models/spree/concerns/user_methods_spec.rb +3 -3
- data/spec/models/spree/credit_card_spec.rb +2 -2
- data/spec/models/spree/customer_return_spec.rb +1 -1
- data/spec/models/spree/order/checkout_spec.rb +1 -1
- data/spec/models/spree/order/outstanding_balance_integration_spec.rb +5 -5
- data/spec/models/spree/order/payment_spec.rb +1 -1
- data/spec/models/spree/order_contents_spec.rb +1 -1
- data/spec/models/spree/order_inventory_spec.rb +3 -3
- data/spec/models/spree/order_shipping_spec.rb +1 -1
- data/spec/models/spree/order_spec.rb +6 -6
- data/spec/models/spree/payment_create_spec.rb +2 -2
- data/spec/models/spree/payment_spec.rb +12 -12
- data/spec/models/spree/promotion/rules/first_repeat_purchase_since_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/nth_order_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/taxon_spec.rb +0 -1
- data/spec/models/spree/promotion_spec.rb +0 -4
- data/spec/models/spree/reimbursement_type/original_payment_spec.rb +2 -2
- data/spec/models/spree/return_item_spec.rb +11 -11
- data/spec/models/spree/shipment_spec.rb +6 -6
- data/spec/models/spree/stock/inventory_units_finalizer_spec.rb +4 -4
- data/spec/models/spree/stock/quantifier_spec.rb +2 -2
- data/spec/models/spree/store_credit_spec.rb +7 -7
- data/spec/models/spree/tax_category_spec.rb +1 -1
- data/spec/models/spree/taxon_spec.rb +2 -2
- data/spec/models/spree/unit_cancel_spec.rb +5 -0
- data/spec/models/spree/user_spec.rb +3 -3
- metadata +32 -32
- data/spec/lib/spree/permitted_attributes_spec.rb +0 -41
data/config/locales/en.yml
CHANGED
|
@@ -163,8 +163,11 @@ en:
|
|
|
163
163
|
type: Type
|
|
164
164
|
spree/price:
|
|
165
165
|
amount: Price
|
|
166
|
+
country: Country
|
|
166
167
|
currency: Currency
|
|
167
168
|
is_default: Currently Valid
|
|
169
|
+
price: Price
|
|
170
|
+
variant: Variant
|
|
168
171
|
spree/product:
|
|
169
172
|
available_on: Available On
|
|
170
173
|
cost_currency: Cost Currency
|
|
@@ -200,6 +203,7 @@ en:
|
|
|
200
203
|
starts_at: Start
|
|
201
204
|
status: Status
|
|
202
205
|
usage_limit: Usage Limit
|
|
206
|
+
uses: Uses
|
|
203
207
|
spree/promotion/actions/create_adjustment:
|
|
204
208
|
description: Creates a promotion credit adjustment on the order
|
|
205
209
|
spree/promotion/actions/create_item_adjustments:
|
|
@@ -238,7 +242,17 @@ en:
|
|
|
238
242
|
spree/promotion/rules/user_role:
|
|
239
243
|
description: Order includes User with specified Role(s)
|
|
240
244
|
spree/promotion_category:
|
|
245
|
+
code: Code
|
|
241
246
|
name: Name
|
|
247
|
+
spree/promotion_code:
|
|
248
|
+
value: Value
|
|
249
|
+
spree/promotion_code_batch:
|
|
250
|
+
base_code: Base code
|
|
251
|
+
email: Email
|
|
252
|
+
join_characters: Join characters
|
|
253
|
+
number_of_codes: Number of codes
|
|
254
|
+
status: Status
|
|
255
|
+
total_codes: Total codes
|
|
242
256
|
spree/property:
|
|
243
257
|
name: Name
|
|
244
258
|
presentation: Presentation
|
|
@@ -250,6 +264,7 @@ en:
|
|
|
250
264
|
active: Active
|
|
251
265
|
code: Code
|
|
252
266
|
name: Name
|
|
267
|
+
state: State
|
|
253
268
|
spree/reimbursement:
|
|
254
269
|
created_at: Date/Time
|
|
255
270
|
number: Number
|
|
@@ -294,6 +309,7 @@ en:
|
|
|
294
309
|
name: Name
|
|
295
310
|
spree/shipping_method:
|
|
296
311
|
admin_name: Internal Name
|
|
312
|
+
available_to_users: Available to users
|
|
297
313
|
carrier: Carrier
|
|
298
314
|
code: Code
|
|
299
315
|
display_on: Display
|
|
@@ -326,6 +342,7 @@ en:
|
|
|
326
342
|
phone: Phone
|
|
327
343
|
propagate_all_variants: Propagate All Variants
|
|
328
344
|
restock_inventory: Restock Inventory
|
|
345
|
+
state: State
|
|
329
346
|
state_id: State
|
|
330
347
|
zipcode: Zip
|
|
331
348
|
spree/stock_movement:
|
|
@@ -358,6 +375,9 @@ en:
|
|
|
358
375
|
action: Action
|
|
359
376
|
amount_remaining: Total Unused
|
|
360
377
|
user_total_amount: Total Amount
|
|
378
|
+
spree/store_credit_reason:
|
|
379
|
+
name: Name
|
|
380
|
+
state: State
|
|
361
381
|
spree/store_credit_update_reason:
|
|
362
382
|
name: Name
|
|
363
383
|
spree/tax_category:
|
|
@@ -372,6 +392,7 @@ en:
|
|
|
372
392
|
name: Name
|
|
373
393
|
show_rate_in_label: Show Rate in Label
|
|
374
394
|
starts_at: Start Date
|
|
395
|
+
tax_categories: Tax Categories
|
|
375
396
|
spree/taxon:
|
|
376
397
|
description: Description
|
|
377
398
|
icon: Icon
|
|
@@ -1923,7 +1944,6 @@ en:
|
|
|
1923
1944
|
select: Select
|
|
1924
1945
|
select_a_reason: Select a reason
|
|
1925
1946
|
select_a_stock_location: Select a stock location
|
|
1926
|
-
select_stock: Select stock
|
|
1927
1947
|
selected_quantity_not_available: selected of %{item} is not available.
|
|
1928
1948
|
send_copy_of_all_mails_to: Send Copy of All Mails To
|
|
1929
1949
|
send_mailer: Send Mailer
|
|
@@ -2202,8 +2222,7 @@ en:
|
|
|
2202
2222
|
you_cannot_undo_action: You will not be able to undo this action
|
|
2203
2223
|
you_have_no_orders_yet: You have no orders yet
|
|
2204
2224
|
your_cart_is_empty: Your cart is empty
|
|
2205
|
-
your_order_is_empty_add_product: Your order is empty
|
|
2206
|
-
a product above
|
|
2225
|
+
your_order_is_empty_add_product: Your order is empty. Please add products first.
|
|
2207
2226
|
zip: Zip
|
|
2208
2227
|
zipcode: Zip Code
|
|
2209
2228
|
zone: Zone
|
|
@@ -58,9 +58,6 @@ module Spree
|
|
|
58
58
|
|
|
59
59
|
def setup_assets
|
|
60
60
|
@lib_name = 'spree'
|
|
61
|
-
|
|
62
|
-
empty_directory 'app/assets/images'
|
|
63
|
-
|
|
64
61
|
%w{javascripts stylesheets images}.each do |path|
|
|
65
62
|
empty_directory "vendor/assets/#{path}/spree/frontend" if defined? Spree::Frontend || Rails.env.test?
|
|
66
63
|
empty_directory "vendor/assets/#{path}/spree/backend" if defined? Spree::Backend || Rails.env.test?
|
|
@@ -31,30 +31,16 @@ module Spree
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def permitted_checkout_attributes
|
|
34
|
-
permitted_attributes.checkout_attributes
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def permitted_checkout_delivery_attributes
|
|
42
|
-
permitted_attributes.checkout_delivery_attributes
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def permitted_checkout_payment_attributes
|
|
46
|
-
permitted_attributes.checkout_payment_attributes
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def permitted_checkout_confirm_attributes
|
|
50
|
-
permitted_attributes.checkout_confirm_attributes
|
|
34
|
+
permitted_attributes.checkout_attributes + [
|
|
35
|
+
bill_address_attributes: permitted_address_attributes,
|
|
36
|
+
ship_address_attributes: permitted_address_attributes,
|
|
37
|
+
payments_attributes: permitted_payment_attributes,
|
|
38
|
+
shipments_attributes: permitted_shipment_attributes
|
|
39
|
+
]
|
|
51
40
|
end
|
|
52
41
|
|
|
53
42
|
def permitted_order_attributes
|
|
54
|
-
|
|
55
|
-
permitted_checkout_delivery_attributes +
|
|
56
|
-
permitted_checkout_payment_attributes +
|
|
57
|
-
permitted_checkout_confirm_attributes + [
|
|
43
|
+
permitted_checkout_attributes + [
|
|
58
44
|
line_items_attributes: permitted_line_item_attributes
|
|
59
45
|
]
|
|
60
46
|
end
|
|
@@ -22,15 +22,6 @@ module Spree
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
-
|
|
26
|
-
def add_class(name)
|
|
27
|
-
Spree::Deprecation.warn(
|
|
28
|
-
'This method is deprecated. ' \
|
|
29
|
-
"Please use `#{self.class}.add_class_set(#{name.inspect})` instead.",
|
|
30
|
-
caller,
|
|
31
|
-
)
|
|
32
|
-
singleton_class.send(:add_class_set, name)
|
|
33
|
-
end
|
|
34
25
|
end
|
|
35
26
|
end
|
|
36
27
|
end
|
|
@@ -29,7 +29,7 @@ module Spree
|
|
|
29
29
|
|
|
30
30
|
completed_at = params.delete(:completed_at)
|
|
31
31
|
|
|
32
|
-
order.
|
|
32
|
+
order.update!(params)
|
|
33
33
|
|
|
34
34
|
order.create_proposed_shipments unless shipments_attrs.present?
|
|
35
35
|
|
|
@@ -104,7 +104,7 @@ module Spree
|
|
|
104
104
|
line_item = order.contents.add(Spree::Variant.find(line_item[:variant_id]), line_item[:quantity])
|
|
105
105
|
# Raise any errors with saving to prevent import succeeding with line items failing silently.
|
|
106
106
|
if extra_params.present?
|
|
107
|
-
line_item.
|
|
107
|
+
line_item.update!(extra_params)
|
|
108
108
|
else
|
|
109
109
|
line_item.save!
|
|
110
110
|
end
|
|
@@ -133,8 +133,7 @@ module Spree
|
|
|
133
133
|
# spree_wombat serializes payment state as status so imported orders should fall back to status field.
|
|
134
134
|
payment.state = p[:state] || p[:status] || 'completed'
|
|
135
135
|
payment.payment_method = Spree::PaymentMethod.find_by!(name: p[:payment_method])
|
|
136
|
-
|
|
137
|
-
payment.source = create_source_payment_from_params(source_attributes, payment) if source_attributes
|
|
136
|
+
payment.source = create_source_payment_from_params(p[:source], payment) if p[:source]
|
|
138
137
|
payment.save!
|
|
139
138
|
end
|
|
140
139
|
end
|
|
@@ -28,11 +28,11 @@ module Spree
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def update
|
|
31
|
-
if product.
|
|
31
|
+
if product.update(product_attrs)
|
|
32
32
|
variants_attrs.each do |variant_attribute|
|
|
33
33
|
# update the variant if the id is present in the payload
|
|
34
34
|
if variant_attribute['id'].present?
|
|
35
|
-
product.variants.find(variant_attribute['id'].to_i).
|
|
35
|
+
product.variants.find(variant_attribute['id'].to_i).update(variant_attribute)
|
|
36
36
|
else
|
|
37
37
|
# make sure the product is assigned before the options=
|
|
38
38
|
product.variants.create({ product: product }.merge(variant_attribute))
|
data/lib/spree/core/version.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Spree
|
|
|
8
8
|
can :display, OptionType
|
|
9
9
|
can :display, OptionValue
|
|
10
10
|
can :create, Order
|
|
11
|
-
can [:read, :update], Order do |order, token|
|
|
11
|
+
can [:read, :update], Order, Order.where(user: user) do |order, token|
|
|
12
12
|
order.user == user || (order.guest_token.present? && token == order.guest_token)
|
|
13
13
|
end
|
|
14
14
|
cannot :update, Order do |order|
|
|
@@ -8,10 +8,7 @@ module Spree
|
|
|
8
8
|
ATTRIBUTES = [
|
|
9
9
|
:address_attributes,
|
|
10
10
|
:address_book_attributes,
|
|
11
|
-
:
|
|
12
|
-
:checkout_delivery_attributes,
|
|
13
|
-
:checkout_payment_attributes,
|
|
14
|
-
:checkout_confirm_attributes,
|
|
11
|
+
:checkout_attributes,
|
|
15
12
|
:credit_card_update_attributes,
|
|
16
13
|
:customer_return_attributes,
|
|
17
14
|
:image_attributes,
|
|
@@ -48,6 +45,10 @@ module Spree
|
|
|
48
45
|
|
|
49
46
|
@@address_book_attributes = address_attributes + [:default]
|
|
50
47
|
|
|
48
|
+
@@checkout_attributes = [
|
|
49
|
+
:coupon_code, :email, :special_instructions, :use_billing
|
|
50
|
+
]
|
|
51
|
+
|
|
51
52
|
@@credit_card_update_attributes = [
|
|
52
53
|
:month, :year, :expiry, :first_name, :last_name, :name
|
|
53
54
|
]
|
|
@@ -90,7 +91,7 @@ module Spree
|
|
|
90
91
|
:number, :month, :year, :expiry, :verification_value,
|
|
91
92
|
:first_name, :last_name, :cc_type, :gateway_customer_profile_id,
|
|
92
93
|
:gateway_payment_profile_id, :last_digits, :name, :encrypted_data,
|
|
93
|
-
:existing_card_id, :wallet_payment_source_id
|
|
94
|
+
:existing_card_id, :wallet_payment_source_id
|
|
94
95
|
]
|
|
95
96
|
|
|
96
97
|
@@stock_item_attributes = [:variant, :stock_location, :backorderable, :variant_id]
|
|
@@ -128,75 +129,5 @@ module Spree
|
|
|
128
129
|
:product_id, :product, :option_values_attributes, :price,
|
|
129
130
|
:weight, :height, :width, :depth, :sku, :cost_currency, option_value_ids: [], options: [:name, :value]
|
|
130
131
|
]
|
|
131
|
-
|
|
132
|
-
@@checkout_address_attributes = [
|
|
133
|
-
:use_billing,
|
|
134
|
-
:email,
|
|
135
|
-
bill_address_attributes: address_attributes,
|
|
136
|
-
ship_address_attributes: address_attributes
|
|
137
|
-
]
|
|
138
|
-
|
|
139
|
-
@@checkout_delivery_attributes = [
|
|
140
|
-
:special_instructions,
|
|
141
|
-
shipments_attributes: shipment_attributes
|
|
142
|
-
]
|
|
143
|
-
|
|
144
|
-
@@checkout_payment_attributes = [
|
|
145
|
-
:coupon_code,
|
|
146
|
-
payments_attributes: payment_attributes + [
|
|
147
|
-
source_attributes: source_attributes
|
|
148
|
-
]
|
|
149
|
-
]
|
|
150
|
-
|
|
151
|
-
@@checkout_confirm_attributes = []
|
|
152
|
-
|
|
153
|
-
def self.checkout_attributes
|
|
154
|
-
Spree::Deprecation.warn <<-WARN.squish, caller
|
|
155
|
-
checkout_attributes is deprecated, please use the permitted
|
|
156
|
-
attributes set for the specific step that needs to be updated.
|
|
157
|
-
|
|
158
|
-
E.g. permitted_checkout_address_attributes
|
|
159
|
-
WARN
|
|
160
|
-
|
|
161
|
-
CheckoutAdditionalAttributes.new(
|
|
162
|
-
checkout_address_attributes +
|
|
163
|
-
checkout_delivery_attributes +
|
|
164
|
-
checkout_payment_attributes +
|
|
165
|
-
checkout_confirm_attributes
|
|
166
|
-
)
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
class CheckoutAdditionalAttributes < Array
|
|
171
|
-
def <<(*attributes)
|
|
172
|
-
super
|
|
173
|
-
|
|
174
|
-
inject_attributes_to_all_steps(attributes, :<<)
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
def push(*attributes)
|
|
178
|
-
super
|
|
179
|
-
|
|
180
|
-
inject_attributes_to_all_steps(attributes, :push)
|
|
181
|
-
end
|
|
182
|
-
alias append push
|
|
183
|
-
|
|
184
|
-
def prepend(*attributes)
|
|
185
|
-
super
|
|
186
|
-
|
|
187
|
-
inject_attributes_to_all_steps(attributes, :prepend)
|
|
188
|
-
end
|
|
189
|
-
alias unshift prepend
|
|
190
|
-
|
|
191
|
-
private
|
|
192
|
-
|
|
193
|
-
def inject_attributes_to_all_steps(attributes, method)
|
|
194
|
-
attributes.each do |attribute|
|
|
195
|
-
PermittedAttributes.checkout_address_attributes.send(method, attribute)
|
|
196
|
-
PermittedAttributes.checkout_delivery_attributes.send(method, attribute)
|
|
197
|
-
PermittedAttributes.checkout_payment_attributes.send(method, attribute)
|
|
198
|
-
PermittedAttributes.checkout_confirm_attributes.send(method, attribute)
|
|
199
|
-
end
|
|
200
|
-
end
|
|
201
132
|
end
|
|
202
133
|
end
|
|
@@ -38,8 +38,12 @@ namespace :db do
|
|
|
38
38
|
# railties:install:migrations and then db:migrate.
|
|
39
39
|
# Migrations should be run one directory at a time
|
|
40
40
|
ActiveRecord::Migrator.migrations_paths.each do |path|
|
|
41
|
-
if
|
|
42
|
-
|
|
41
|
+
if Rails.gem_version >= Gem::Version.new('6.0.0')
|
|
42
|
+
ActiveRecord::MigrationContext.new(
|
|
43
|
+
[path],
|
|
44
|
+
ActiveRecord::SchemaMigration
|
|
45
|
+
).migrate
|
|
46
|
+
elsif Rails.gem_version >= Gem::Version.new('5.2.0')
|
|
43
47
|
ActiveRecord::MigrationContext.new([path]).migrate
|
|
44
48
|
else
|
|
45
49
|
ActiveRecord::Migrator.migrate(path)
|
data/solidus_core.gemspec
CHANGED
|
@@ -24,13 +24,13 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
actionmailer actionpack actionview activejob activemodel activerecord
|
|
25
25
|
activesupport railties
|
|
26
26
|
].each do |rails_dep|
|
|
27
|
-
s.add_dependency rails_dep, ['>= 5.1', '<
|
|
27
|
+
s.add_dependency rails_dep, ['>= 5.1', '< 7.0.x']
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
s.add_dependency 'activemerchant', '~> 1.66'
|
|
31
31
|
s.add_dependency 'acts_as_list', '~> 0.3'
|
|
32
|
-
s.add_dependency 'awesome_nested_set', '~> 3.
|
|
33
|
-
s.add_dependency 'cancancan', '
|
|
32
|
+
s.add_dependency 'awesome_nested_set', '~> 3.2'
|
|
33
|
+
s.add_dependency 'cancancan', ['>= 2.2', '< 4.0']
|
|
34
34
|
s.add_dependency 'carmen', '~> 1.1.0'
|
|
35
35
|
s.add_dependency 'discard', '~> 1.0'
|
|
36
36
|
s.add_dependency 'friendly_id', '~> 5.0'
|
|
@@ -39,5 +39,5 @@ Gem::Specification.new do |s|
|
|
|
39
39
|
s.add_dependency 'paperclip', ['>= 4.2', '< 6']
|
|
40
40
|
s.add_dependency 'paranoia', '~> 2.4'
|
|
41
41
|
s.add_dependency 'ransack', '~> 2.0'
|
|
42
|
-
s.add_dependency 'state_machines-activerecord', '~> 0.
|
|
42
|
+
s.add_dependency 'state_machines-activerecord', '~> 0.6'
|
|
43
43
|
end
|
|
@@ -60,7 +60,11 @@ RSpec.describe Spree::Core::Search::Base do
|
|
|
60
60
|
search: { "price_range_any" => ["Under $10.00", "$10.00 - $15.00"] } }
|
|
61
61
|
searcher = Spree::Core::Search::Base.new(params)
|
|
62
62
|
expect(searcher.send(:get_base_scope).to_sql).to match /<= 10/
|
|
63
|
-
|
|
63
|
+
if Rails.gem_version >= Gem::Version.new('6.0.0')
|
|
64
|
+
expect(searcher.send(:get_base_scope).to_sql).to match /between 10\.0 and 15\.0/i
|
|
65
|
+
else
|
|
66
|
+
expect(searcher.send(:get_base_scope).to_sql).to match /between 10 and 15/i
|
|
67
|
+
end
|
|
64
68
|
expect(searcher.retrieve_products.count).to eq(2)
|
|
65
69
|
end
|
|
66
70
|
|
|
@@ -23,14 +23,7 @@ RSpec.describe Spree::Core::ControllerHelpers::StrongParameters, type: :controll
|
|
|
23
23
|
|
|
24
24
|
describe '#permitted_checkout_attributes' do
|
|
25
25
|
it 'returns Array class' do
|
|
26
|
-
|
|
27
|
-
expect(controller.permitted_checkout_attributes.class).to eq Spree::CheckoutAdditionalAttributes
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'is deprecated' do
|
|
32
|
-
expect(Spree::Deprecation).to receive(:warn)
|
|
33
|
-
controller.permitted_checkout_attributes
|
|
26
|
+
expect(controller.permitted_checkout_attributes.class).to eq Array
|
|
34
27
|
end
|
|
35
28
|
end
|
|
36
29
|
|
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
|
4
4
|
require 'spree/core/environment_extension'
|
|
5
5
|
|
|
6
6
|
RSpec.describe Spree::Core::EnvironmentExtension do
|
|
7
|
-
let(:base) { Class.new
|
|
7
|
+
let(:base) { Class.new }
|
|
8
8
|
subject! { base.include(described_class).new }
|
|
9
9
|
|
|
10
10
|
describe '.add_class_set' do
|
|
@@ -32,15 +32,4 @@ RSpec.describe Spree::Core::EnvironmentExtension do
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
-
|
|
36
|
-
describe '#add_class' do
|
|
37
|
-
it 'is deprecated' do
|
|
38
|
-
expect(Spree::Deprecation).to receive(:warn) do |message, _caller|
|
|
39
|
-
expect(message).to include('ExampleClass.add_class_set(:foo)')
|
|
40
|
-
end
|
|
41
|
-
expect(base).to receive(:add_class_set).with(:foo)
|
|
42
|
-
|
|
43
|
-
base.new.add_class(:foo)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
35
|
end
|
|
@@ -18,14 +18,26 @@ RSpec.describe Spree::Event do
|
|
|
18
18
|
before do
|
|
19
19
|
# ActiveSupport::Notifications does not provide an interface to clean all
|
|
20
20
|
# subscribers at once, so some low level brittle code is required
|
|
21
|
-
|
|
21
|
+
if Rails.gem_version >= Gem::Version.new('6.0.0')
|
|
22
|
+
@old_string_subscribers = notifier.instance_variable_get('@string_subscribers').dup
|
|
23
|
+
@old_other_subscribers = notifier.instance_variable_get('@other_subscribers').dup
|
|
24
|
+
notifier.instance_variable_get('@string_subscribers').clear
|
|
25
|
+
notifier.instance_variable_get('@other_subscribers').clear
|
|
26
|
+
else
|
|
27
|
+
@old_subscribers = notifier.instance_variable_get('@subscribers').dup
|
|
28
|
+
notifier.instance_variable_get('@subscribers').clear
|
|
29
|
+
end
|
|
22
30
|
@old_listeners = notifier.instance_variable_get('@listeners_for').dup
|
|
23
|
-
notifier.instance_variable_get('@subscribers').clear
|
|
24
31
|
notifier.instance_variable_get('@listeners_for').clear
|
|
25
32
|
end
|
|
26
33
|
|
|
27
34
|
after do
|
|
28
|
-
|
|
35
|
+
if Rails.gem_version >= Gem::Version.new('6.0.0')
|
|
36
|
+
notifier.instance_variable_set '@string_subscribers', @old_string_subscribers
|
|
37
|
+
notifier.instance_variable_set '@other_subscribers', @old_other_subscribers
|
|
38
|
+
else
|
|
39
|
+
notifier.instance_variable_set '@subscribers', @old_subscribers
|
|
40
|
+
end
|
|
29
41
|
notifier.instance_variable_set '@listeners_for', @old_listeners
|
|
30
42
|
end
|
|
31
43
|
|
|
@@ -6,8 +6,12 @@ require Spree::Core::Engine.root.join('db/migrate/20190106184413_remove_code_fro
|
|
|
6
6
|
RSpec.describe RemoveCodeFromSpreePromotions do
|
|
7
7
|
let(:migrations_paths) { ActiveRecord::Migrator.migrations_paths }
|
|
8
8
|
let(:migrations) do
|
|
9
|
-
if
|
|
10
|
-
|
|
9
|
+
if Rails.gem_version >= Gem::Version.new('6.0.0')
|
|
10
|
+
ActiveRecord::MigrationContext.new(
|
|
11
|
+
migrations_paths,
|
|
12
|
+
ActiveRecord::SchemaMigration
|
|
13
|
+
).migrations
|
|
14
|
+
elsif Rails.gem_version >= Gem::Version.new('5.2.0')
|
|
11
15
|
ActiveRecord::MigrationContext.new(migrations_paths).migrations
|
|
12
16
|
else
|
|
13
17
|
ActiveRecord::Migrator.migrations(migrations_paths)
|
|
@@ -16,7 +20,13 @@ RSpec.describe RemoveCodeFromSpreePromotions do
|
|
|
16
20
|
let(:previous_version) { 20180710170104 }
|
|
17
21
|
let(:current_version) { 20190106184413 }
|
|
18
22
|
|
|
19
|
-
subject
|
|
23
|
+
subject do
|
|
24
|
+
if Rails.gem_version >= Gem::Version.new('6.0.0')
|
|
25
|
+
ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration, current_version).migrate
|
|
26
|
+
else
|
|
27
|
+
ActiveRecord::Migrator.new(:up, migrations, current_version).migrate
|
|
28
|
+
end
|
|
29
|
+
end
|
|
20
30
|
|
|
21
31
|
# This is needed for MySQL since it is not able to rollback to the previous
|
|
22
32
|
# state when database schema changes within that transaction.
|
|
@@ -28,7 +38,11 @@ RSpec.describe RemoveCodeFromSpreePromotions do
|
|
|
28
38
|
# Silence migrations output in specs report.
|
|
29
39
|
ActiveRecord::Migration.suppress_messages do
|
|
30
40
|
# Migrate back to the previous version
|
|
31
|
-
|
|
41
|
+
if Rails.gem_version >= Gem::Version.new('6.0.0')
|
|
42
|
+
ActiveRecord::Migrator.new(:down, migrations, ActiveRecord::SchemaMigration, previous_version).migrate
|
|
43
|
+
else
|
|
44
|
+
ActiveRecord::Migrator.new(:down, migrations, previous_version).migrate
|
|
45
|
+
end
|
|
32
46
|
# If other tests using Spree::Promotion ran before this one, Rails has
|
|
33
47
|
# stored information about table's columns and we need to reset those
|
|
34
48
|
# since the migration changed the database structure.
|
|
@@ -36,7 +36,7 @@ RSpec.describe Spree::Calculator::Returns::DefaultRefundAmount, type: :model do
|
|
|
36
36
|
source_type: 'Spree::Order'
|
|
37
37
|
)
|
|
38
38
|
|
|
39
|
-
order.adjustments.first.
|
|
39
|
+
order.adjustments.first.update(amount: adjustment_amount)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
it 'will return the line item amount deducted of refund' do
|
|
@@ -73,8 +73,8 @@ RSpec.describe Spree::Carton do
|
|
|
73
73
|
let(:email) { 'something@something.com' }
|
|
74
74
|
|
|
75
75
|
before do
|
|
76
|
-
first_order.
|
|
77
|
-
second_order.
|
|
76
|
+
first_order.update!(email: email)
|
|
77
|
+
second_order.update!(email: email)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
it "returns a unique list of the order emails it is associated to" do
|
|
@@ -76,19 +76,19 @@ RSpec.describe Spree::UserMethods do
|
|
|
76
76
|
it { is_expected.to eq(100 + 200) }
|
|
77
77
|
|
|
78
78
|
context 'when some has been used' do
|
|
79
|
-
before { credit_1.
|
|
79
|
+
before { credit_1.update!(amount_used: 35) }
|
|
80
80
|
|
|
81
81
|
it { is_expected.to eq(100 + 200 - 35) }
|
|
82
82
|
|
|
83
83
|
context 'when some has been authorized' do
|
|
84
|
-
before { credit_1.
|
|
84
|
+
before { credit_1.update!(amount_authorized: 10) }
|
|
85
85
|
|
|
86
86
|
it { is_expected.to eq(100 + 200 - 35 - 10) }
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
context 'when some has been authorized' do
|
|
91
|
-
before { credit_1.
|
|
91
|
+
before { credit_1.update!(amount_authorized: 10) }
|
|
92
92
|
|
|
93
93
|
it { is_expected.to eq(100 + 200 - 10) }
|
|
94
94
|
end
|
|
@@ -109,10 +109,10 @@ RSpec.describe Spree::CreditCard, type: :model do
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
it "should save and update addresses through nested attributes" do
|
|
112
|
-
persisted_card.
|
|
112
|
+
persisted_card.update({ address_attributes: valid_address_attributes })
|
|
113
113
|
persisted_card.save!
|
|
114
114
|
updated_attributes = { id: persisted_card.address.id, address1: "123 Main St." }
|
|
115
|
-
persisted_card.
|
|
115
|
+
persisted_card.update({ address_attributes: updated_attributes })
|
|
116
116
|
expect(persisted_card.address.address1).to eq "123 Main St."
|
|
117
117
|
end
|
|
118
118
|
end
|
|
@@ -233,7 +233,7 @@ RSpec.describe Spree::CustomerReturn, type: :model do
|
|
|
233
233
|
|
|
234
234
|
context "it was not received" do
|
|
235
235
|
before do
|
|
236
|
-
return_item.
|
|
236
|
+
return_item.update!(reception_status: "lost_in_transit")
|
|
237
237
|
end
|
|
238
238
|
|
|
239
239
|
it 'should not updated inventory unit to returned' do
|
|
@@ -456,7 +456,7 @@ RSpec.describe Spree::Order, type: :model do
|
|
|
456
456
|
order.line_items << FactoryBot.create(:line_item)
|
|
457
457
|
order.line_items.first.variant.stock_items.each do |si|
|
|
458
458
|
si.set_count_on_hand(0)
|
|
459
|
-
si.
|
|
459
|
+
si.update(backorderable: false)
|
|
460
460
|
end
|
|
461
461
|
|
|
462
462
|
Spree::OrderUpdater.new(order).update
|
|
@@ -16,7 +16,7 @@ RSpec.describe "Outstanding balance integration tests" do
|
|
|
16
16
|
let!(:order) { create(:order_with_line_items, line_items_count: 2, line_items_price: 3, shipment_cost: 13) }
|
|
17
17
|
let(:item_1) { order.line_items[0] }
|
|
18
18
|
let(:item_2) { order.line_items[1] }
|
|
19
|
-
before { order.
|
|
19
|
+
before { order.update!(state: 'complete', completed_at: Time.now) }
|
|
20
20
|
|
|
21
21
|
subject do
|
|
22
22
|
order.reload
|
|
@@ -44,11 +44,11 @@ RSpec.describe "Outstanding balance integration tests" do
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
context 'when the order is cancelled' do
|
|
47
|
-
before { order.
|
|
47
|
+
before { order.update!(state: "canceled") }
|
|
48
48
|
it { should eq(-19) }
|
|
49
49
|
|
|
50
50
|
context 'and the payment is voided' do
|
|
51
|
-
before { payment.
|
|
51
|
+
before { payment.update!(state: "void") }
|
|
52
52
|
it { should eq 0 }
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -116,11 +116,11 @@ RSpec.describe "Outstanding balance integration tests" do
|
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
context 'when the order is cancelled' do
|
|
119
|
-
before { order.
|
|
119
|
+
before { order.update!(state: "canceled") }
|
|
120
120
|
it { should eq(-10) }
|
|
121
121
|
|
|
122
122
|
context 'and the payment is voided' do
|
|
123
|
-
before { payment.
|
|
123
|
+
before { payment.update!(state: "void") }
|
|
124
124
|
it { should eq 0 }
|
|
125
125
|
end
|
|
126
126
|
|
|
@@ -134,7 +134,7 @@ RSpec.describe Spree::OrderContents, type: :model do
|
|
|
134
134
|
|
|
135
135
|
context 'when the order does not have a taxable address' do
|
|
136
136
|
before do
|
|
137
|
-
order.
|
|
137
|
+
order.update!(ship_address: nil, bill_address: nil)
|
|
138
138
|
expect(order.tax_address.country_id).to be_nil
|
|
139
139
|
end
|
|
140
140
|
|