solidus_core 2.10.0.beta1 → 2.10.5
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/helpers/spree/base_helper.rb +4 -4
- data/app/helpers/spree/products_helper.rb +2 -1
- data/app/jobs/spree/promotion_code_batch_job.rb +2 -2
- data/app/models/concerns/spree/user_methods.rb +2 -2
- data/app/models/spree/address.rb +11 -15
- data/app/models/spree/adjustment.rb +11 -0
- data/app/models/spree/calculator/price_sack.rb +1 -1
- data/app/models/spree/calculator/shipping/flexi_rate.rb +2 -2
- data/app/models/spree/calculator/tiered_flat_rate.rb +5 -5
- data/app/models/spree/calculator/tiered_percent.rb +6 -6
- data/app/models/spree/carton.rb +1 -1
- data/app/models/spree/credit_card.rb +2 -2
- data/app/models/spree/inventory_unit.rb +1 -19
- data/app/models/spree/line_item.rb +1 -1
- data/app/models/spree/order.rb +3 -2
- data/app/models/spree/order/checkout.rb +1 -1
- data/app/models/spree/order/payments.rb +2 -2
- data/app/models/spree/order_capturing.rb +2 -2
- data/app/models/spree/order_taxation.rb +2 -2
- data/app/models/spree/payment.rb +4 -41
- data/app/models/spree/payment/processing.rb +2 -2
- data/app/models/spree/payment_method.rb +2 -2
- data/app/models/spree/product.rb +3 -3
- data/app/models/spree/product/scopes.rb +9 -8
- data/app/models/spree/promotion.rb +27 -12
- data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +1 -1
- data/app/models/spree/promotion/actions/free_shipping.rb +1 -1
- data/app/models/spree/promotion/rules/option_value.rb +2 -2
- data/app/models/spree/promotion/rules/product.rb +3 -3
- data/app/models/spree/promotion_action.rb +1 -1
- data/app/models/spree/promotion_chooser.rb +2 -2
- data/app/models/spree/promotion_code.rb +9 -8
- data/app/models/spree/promotion_code/batch_builder.rb +3 -3
- data/app/models/spree/promotion_rule.rb +1 -1
- data/app/models/spree/refund.rb +2 -2
- data/app/models/spree/reimbursement.rb +3 -11
- data/app/models/spree/reimbursement/reimbursement_type_engine.rb +1 -1
- data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +2 -2
- data/app/models/spree/return_authorization.rb +1 -7
- data/app/models/spree/return_item.rb +3 -42
- data/app/models/spree/return_item/eligibility_validator/default.rb +1 -1
- data/app/models/spree/shipment.rb +4 -38
- data/app/models/spree/shipping_calculator.rb +0 -4
- data/app/models/spree/shipping_method.rb +1 -1
- data/app/models/spree/state.rb +1 -1
- data/app/models/spree/stock/differentiator.rb +1 -1
- data/app/models/spree/stock/package.rb +1 -1
- data/app/models/spree/stock_item.rb +1 -1
- data/app/models/spree/stock_quantities.rb +13 -12
- data/app/models/spree/tax_calculator/default.rb +0 -4
- data/app/models/spree/tax_calculator/shipping_rate.rb +0 -3
- data/app/models/spree/tax_rate.rb +4 -0
- data/app/models/spree/taxon/paperclip_attachment.rb +13 -0
- data/app/models/spree/user_last_url_storer.rb +46 -0
- data/app/models/spree/user_last_url_storer/rules/authentication_rule.rb +36 -0
- data/app/models/spree/variant.rb +9 -9
- data/app/models/spree/wallet/add_payment_sources_to_wallet.rb +1 -1
- data/app/models/spree/zone.rb +1 -1
- data/config/initializers/money.rb +2 -0
- data/config/locales/en.yml +12 -0
- data/lib/generators/spree/install/install_generator.rb +3 -0
- data/lib/generators/spree/install/templates/config/initializers/spree.rb.tt +8 -0
- data/lib/spree/app_configuration.rb +18 -3
- data/lib/spree/core.rb +12 -0
- data/lib/spree/core/controller_helpers/auth.rb +1 -13
- data/lib/spree/core/controller_helpers/strong_parameters.rb +21 -7
- data/lib/spree/core/engine.rb +2 -2
- data/lib/spree/core/environment_extension.rb +9 -0
- data/lib/spree/core/importer/order.rb +27 -26
- data/lib/spree/core/product_filters.rb +15 -15
- data/lib/spree/core/role_configuration.rb +2 -2
- data/lib/spree/core/search/variant.rb +1 -1
- data/lib/spree/core/state_machines.rb +78 -0
- data/lib/spree/core/state_machines/inventory_unit.rb +42 -0
- data/lib/spree/core/state_machines/payment.rb +61 -0
- data/lib/spree/core/state_machines/reimbursement.rb +33 -0
- data/lib/spree/core/state_machines/return_authorization.rb +32 -0
- data/lib/spree/core/state_machines/return_item/acceptance_status.rb +51 -0
- data/lib/spree/core/state_machines/return_item/reception_status.rb +42 -0
- data/lib/spree/core/state_machines/shipment.rb +58 -0
- data/lib/spree/core/stock_configuration.rb +1 -0
- data/lib/spree/core/validators/email.rb +1 -8
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/money.rb +2 -2
- data/lib/spree/permission_sets/user_management.rb +3 -0
- data/lib/spree/permitted_attributes.rb +78 -9
- data/lib/spree/preferences/static_model_preferences.rb +2 -2
- data/lib/spree/testing_support/dummy_app.rb +4 -1
- data/lib/spree/testing_support/factories/inventory_unit_factory.rb +8 -1
- data/lib/spree/testing_support/factories/promotion_factory.rb +7 -0
- data/lib/spree/testing_support/factories/stock_package_factory.rb +1 -1
- data/lib/spree/testing_support/factories/user_factory.rb +4 -1
- data/solidus_core.gemspec +4 -4
- data/spec/lib/spree/core/controller_helpers/strong_parameters_spec.rb +8 -1
- data/spec/lib/spree/core/environment_extension_spec.rb +12 -1
- data/spec/lib/spree/core/stock_configuration_spec.rb +36 -0
- data/spec/lib/spree/core/validators/email_spec.rb +18 -18
- data/spec/lib/spree/permitted_attributes_spec.rb +41 -0
- data/spec/models/spree/ability_spec.rb +1 -1
- data/spec/models/spree/address_spec.rb +23 -0
- data/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb +1 -1
- data/spec/models/spree/calculator/shipping/flat_rate_spec.rb +1 -1
- data/spec/models/spree/calculator/shipping/flexi_rate_spec.rb +2 -2
- data/spec/models/spree/calculator/shipping/per_item_spec.rb +1 -1
- data/spec/models/spree/calculator/shipping/price_sack_spec.rb +24 -15
- data/spec/models/spree/carton_spec.rb +8 -0
- data/spec/models/spree/classification_spec.rb +21 -9
- data/spec/models/spree/concerns/user_address_book_spec.rb +4 -4
- data/spec/models/spree/concerns/user_methods_spec.rb +2 -1
- data/spec/models/spree/order_merger_spec.rb +3 -3
- data/spec/models/spree/order_spec.rb +8 -15
- data/spec/models/spree/order_updater_spec.rb +4 -3
- data/spec/models/spree/payment_create_spec.rb +4 -14
- data/spec/models/spree/permission_sets/user_management_spec.rb +2 -0
- data/spec/models/spree/preference_spec.rb +4 -4
- data/spec/models/spree/preferences/preferable_spec.rb +3 -3
- data/spec/models/spree/preferences/statically_configurable_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/taxon_spec.rb +1 -0
- data/spec/models/spree/promotion_rule_spec.rb +6 -6
- data/spec/models/spree/promotion_spec.rb +73 -52
- data/spec/models/spree/reimbursement_type/original_payment_spec.rb +1 -1
- data/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb +1 -1
- data/spec/models/spree/returns_calculator_spec.rb +2 -2
- data/spec/models/spree/shipping_calculator_spec.rb +1 -13
- data/spec/models/spree/shipping_method_spec.rb +32 -0
- data/spec/models/spree/stock/availability_validator_spec.rb +2 -2
- data/spec/models/spree/stock/differentiator_spec.rb +2 -2
- data/spec/models/spree/stock/estimator_spec.rb +3 -3
- data/spec/models/spree/stock/package_spec.rb +28 -28
- data/spec/models/spree/stock/simple_coordinator_spec.rb +11 -11
- data/spec/models/spree/stock/splitter/base_spec.rb +4 -4
- data/spec/models/spree/stock/splitter/shipping_category_spec.rb +7 -7
- data/spec/models/spree/stock_quantities_spec.rb +1 -1
- data/spec/models/spree/store_credit_spec.rb +1 -1
- data/spec/models/spree/tax_rate_spec.rb +1 -0
- data/spec/models/spree/taxons/paperclip_attachment_spec.rb +29 -0
- data/spec/models/spree/user_last_url_storer/rules/authentication_rule_spec.rb +31 -0
- data/spec/models/spree/user_last_url_storer_spec.rb +60 -0
- metadata +41 -35
- data/spec/migrate/20190106184413_remove_code_from_spree_promotions_spec.rb +0 -162
- data/spec/models/spree/order/updating_spec.rb +0 -18
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.10.
|
|
4
|
+
version: 2.10.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Solidus Team
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionmailer
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: '5.1'
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
22
|
+
version: 6.1.x
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
version: '5.1'
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: 6.1.x
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: actionpack
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
version: '5.1'
|
|
40
40
|
- - "<"
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version:
|
|
42
|
+
version: 6.1.x
|
|
43
43
|
type: :runtime
|
|
44
44
|
prerelease: false
|
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -49,7 +49,7 @@ dependencies:
|
|
|
49
49
|
version: '5.1'
|
|
50
50
|
- - "<"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version:
|
|
52
|
+
version: 6.1.x
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
54
|
name: actionview
|
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -59,7 +59,7 @@ dependencies:
|
|
|
59
59
|
version: '5.1'
|
|
60
60
|
- - "<"
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version:
|
|
62
|
+
version: 6.1.x
|
|
63
63
|
type: :runtime
|
|
64
64
|
prerelease: false
|
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -69,7 +69,7 @@ dependencies:
|
|
|
69
69
|
version: '5.1'
|
|
70
70
|
- - "<"
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version:
|
|
72
|
+
version: 6.1.x
|
|
73
73
|
- !ruby/object:Gem::Dependency
|
|
74
74
|
name: activejob
|
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -79,7 +79,7 @@ dependencies:
|
|
|
79
79
|
version: '5.1'
|
|
80
80
|
- - "<"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
82
|
+
version: 6.1.x
|
|
83
83
|
type: :runtime
|
|
84
84
|
prerelease: false
|
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -89,7 +89,7 @@ dependencies:
|
|
|
89
89
|
version: '5.1'
|
|
90
90
|
- - "<"
|
|
91
91
|
- !ruby/object:Gem::Version
|
|
92
|
-
version:
|
|
92
|
+
version: 6.1.x
|
|
93
93
|
- !ruby/object:Gem::Dependency
|
|
94
94
|
name: activemodel
|
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,7 +99,7 @@ dependencies:
|
|
|
99
99
|
version: '5.1'
|
|
100
100
|
- - "<"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version:
|
|
102
|
+
version: 6.1.x
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -109,7 +109,7 @@ dependencies:
|
|
|
109
109
|
version: '5.1'
|
|
110
110
|
- - "<"
|
|
111
111
|
- !ruby/object:Gem::Version
|
|
112
|
-
version:
|
|
112
|
+
version: 6.1.x
|
|
113
113
|
- !ruby/object:Gem::Dependency
|
|
114
114
|
name: activerecord
|
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -119,7 +119,7 @@ dependencies:
|
|
|
119
119
|
version: '5.1'
|
|
120
120
|
- - "<"
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
|
-
version:
|
|
122
|
+
version: 6.1.x
|
|
123
123
|
type: :runtime
|
|
124
124
|
prerelease: false
|
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -129,7 +129,7 @@ dependencies:
|
|
|
129
129
|
version: '5.1'
|
|
130
130
|
- - "<"
|
|
131
131
|
- !ruby/object:Gem::Version
|
|
132
|
-
version:
|
|
132
|
+
version: 6.1.x
|
|
133
133
|
- !ruby/object:Gem::Dependency
|
|
134
134
|
name: activesupport
|
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -139,7 +139,7 @@ dependencies:
|
|
|
139
139
|
version: '5.1'
|
|
140
140
|
- - "<"
|
|
141
141
|
- !ruby/object:Gem::Version
|
|
142
|
-
version:
|
|
142
|
+
version: 6.1.x
|
|
143
143
|
type: :runtime
|
|
144
144
|
prerelease: false
|
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -149,7 +149,7 @@ dependencies:
|
|
|
149
149
|
version: '5.1'
|
|
150
150
|
- - "<"
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
|
-
version:
|
|
152
|
+
version: 6.1.x
|
|
153
153
|
- !ruby/object:Gem::Dependency
|
|
154
154
|
name: railties
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -159,7 +159,7 @@ dependencies:
|
|
|
159
159
|
version: '5.1'
|
|
160
160
|
- - "<"
|
|
161
161
|
- !ruby/object:Gem::Version
|
|
162
|
-
version:
|
|
162
|
+
version: 6.1.x
|
|
163
163
|
type: :runtime
|
|
164
164
|
prerelease: false
|
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -169,7 +169,7 @@ dependencies:
|
|
|
169
169
|
version: '5.1'
|
|
170
170
|
- - "<"
|
|
171
171
|
- !ruby/object:Gem::Version
|
|
172
|
-
version:
|
|
172
|
+
version: 6.1.x
|
|
173
173
|
- !ruby/object:Gem::Dependency
|
|
174
174
|
name: activemerchant
|
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -188,16 +188,16 @@ dependencies:
|
|
|
188
188
|
name: acts_as_list
|
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
|
190
190
|
requirements:
|
|
191
|
-
- - "
|
|
191
|
+
- - "<"
|
|
192
192
|
- !ruby/object:Gem::Version
|
|
193
|
-
version: '0
|
|
193
|
+
version: '2.0'
|
|
194
194
|
type: :runtime
|
|
195
195
|
prerelease: false
|
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
|
197
197
|
requirements:
|
|
198
|
-
- - "
|
|
198
|
+
- - "<"
|
|
199
199
|
- !ruby/object:Gem::Version
|
|
200
|
-
version: '0
|
|
200
|
+
version: '2.0'
|
|
201
201
|
- !ruby/object:Gem::Dependency
|
|
202
202
|
name: awesome_nested_set
|
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -309,9 +309,6 @@ dependencies:
|
|
|
309
309
|
- - ">="
|
|
310
310
|
- !ruby/object:Gem::Version
|
|
311
311
|
version: '4.2'
|
|
312
|
-
- - "<"
|
|
313
|
-
- !ruby/object:Gem::Version
|
|
314
|
-
version: '6'
|
|
315
312
|
type: :runtime
|
|
316
313
|
prerelease: false
|
|
317
314
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -319,9 +316,6 @@ dependencies:
|
|
|
319
316
|
- - ">="
|
|
320
317
|
- !ruby/object:Gem::Version
|
|
321
318
|
version: '4.2'
|
|
322
|
-
- - "<"
|
|
323
|
-
- !ruby/object:Gem::Version
|
|
324
|
-
version: '6'
|
|
325
319
|
- !ruby/object:Gem::Dependency
|
|
326
320
|
name: paranoia
|
|
327
321
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -619,6 +613,8 @@ files:
|
|
|
619
613
|
- app/models/spree/unit_cancel.rb
|
|
620
614
|
- app/models/spree/user_address.rb
|
|
621
615
|
- app/models/spree/user_class_handle.rb
|
|
616
|
+
- app/models/spree/user_last_url_storer.rb
|
|
617
|
+
- app/models/spree/user_last_url_storer/rules/authentication_rule.rb
|
|
622
618
|
- app/models/spree/user_stock_location.rb
|
|
623
619
|
- app/models/spree/validations/db_maximum_length_validator.rb
|
|
624
620
|
- app/models/spree/variant.rb
|
|
@@ -742,6 +738,14 @@ files:
|
|
|
742
738
|
- lib/spree/core/role_configuration.rb
|
|
743
739
|
- lib/spree/core/search/base.rb
|
|
744
740
|
- lib/spree/core/search/variant.rb
|
|
741
|
+
- lib/spree/core/state_machines.rb
|
|
742
|
+
- lib/spree/core/state_machines/inventory_unit.rb
|
|
743
|
+
- lib/spree/core/state_machines/payment.rb
|
|
744
|
+
- lib/spree/core/state_machines/reimbursement.rb
|
|
745
|
+
- lib/spree/core/state_machines/return_authorization.rb
|
|
746
|
+
- lib/spree/core/state_machines/return_item/acceptance_status.rb
|
|
747
|
+
- lib/spree/core/state_machines/return_item/reception_status.rb
|
|
748
|
+
- lib/spree/core/state_machines/shipment.rb
|
|
745
749
|
- lib/spree/core/stock_configuration.rb
|
|
746
750
|
- lib/spree/core/validators/email.rb
|
|
747
751
|
- lib/spree/core/version.rb
|
|
@@ -972,6 +976,7 @@ files:
|
|
|
972
976
|
- spec/lib/spree/migrations_spec.rb
|
|
973
977
|
- spec/lib/spree/money_spec.rb
|
|
974
978
|
- spec/lib/spree/permission_sets/default_customer_spec.rb
|
|
979
|
+
- spec/lib/spree/permitted_attributes_spec.rb
|
|
975
980
|
- spec/lib/spree/promo/environment_spec.rb
|
|
976
981
|
- spec/lib/tasks/dummy_task.rake
|
|
977
982
|
- spec/lib/tasks/dummy_task_spec.rb
|
|
@@ -981,7 +986,6 @@ files:
|
|
|
981
986
|
- spec/mailers/promotion_code_batch_mailer_spec.rb
|
|
982
987
|
- spec/mailers/reimbursement_mailer_spec.rb
|
|
983
988
|
- spec/mailers/test_mailer_spec.rb
|
|
984
|
-
- spec/migrate/20190106184413_remove_code_from_spree_promotions_spec.rb
|
|
985
989
|
- spec/models/spree/ability_spec.rb
|
|
986
990
|
- spec/models/spree/address_spec.rb
|
|
987
991
|
- spec/models/spree/adjustment_reason_spec.rb
|
|
@@ -1038,7 +1042,6 @@ files:
|
|
|
1038
1042
|
- spec/models/spree/order/risk_assessment_spec.rb
|
|
1039
1043
|
- spec/models/spree/order/state_machine_spec.rb
|
|
1040
1044
|
- spec/models/spree/order/totals_spec.rb
|
|
1041
|
-
- spec/models/spree/order/updating_spec.rb
|
|
1042
1045
|
- spec/models/spree/order/validations_spec.rb
|
|
1043
1046
|
- spec/models/spree/order_cancellations_spec.rb
|
|
1044
1047
|
- spec/models/spree/order_capturing_spec.rb
|
|
@@ -1186,7 +1189,10 @@ files:
|
|
|
1186
1189
|
- spec/models/spree/tax_rate_spec.rb
|
|
1187
1190
|
- spec/models/spree/taxon_spec.rb
|
|
1188
1191
|
- spec/models/spree/taxonomy_spec.rb
|
|
1192
|
+
- spec/models/spree/taxons/paperclip_attachment_spec.rb
|
|
1189
1193
|
- spec/models/spree/unit_cancel_spec.rb
|
|
1194
|
+
- spec/models/spree/user_last_url_storer/rules/authentication_rule_spec.rb
|
|
1195
|
+
- spec/models/spree/user_last_url_storer_spec.rb
|
|
1190
1196
|
- spec/models/spree/user_spec.rb
|
|
1191
1197
|
- spec/models/spree/validations/db_maximum_length_validator_spec.rb
|
|
1192
1198
|
- spec/models/spree/variant/price_selector_spec.rb
|
|
@@ -1215,7 +1221,7 @@ homepage: http://solidus.io
|
|
|
1215
1221
|
licenses:
|
|
1216
1222
|
- BSD-3-Clause
|
|
1217
1223
|
metadata: {}
|
|
1218
|
-
post_install_message:
|
|
1224
|
+
post_install_message:
|
|
1219
1225
|
rdoc_options: []
|
|
1220
1226
|
require_paths:
|
|
1221
1227
|
- lib
|
|
@@ -1223,15 +1229,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
1223
1229
|
requirements:
|
|
1224
1230
|
- - ">="
|
|
1225
1231
|
- !ruby/object:Gem::Version
|
|
1226
|
-
version: 2.
|
|
1232
|
+
version: 2.4.0
|
|
1227
1233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1228
1234
|
requirements:
|
|
1229
1235
|
- - ">="
|
|
1230
1236
|
- !ruby/object:Gem::Version
|
|
1231
1237
|
version: 1.8.23
|
|
1232
1238
|
requirements: []
|
|
1233
|
-
rubygems_version: 3.
|
|
1234
|
-
signing_key:
|
|
1239
|
+
rubygems_version: 3.1.4
|
|
1240
|
+
signing_key:
|
|
1235
1241
|
specification_version: 4
|
|
1236
1242
|
summary: Essential models, mailers, and classes for the Solidus e-commerce project.
|
|
1237
1243
|
test_files: []
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rails_helper'
|
|
4
|
-
require Spree::Core::Engine.root.join('db/migrate/20190106184413_remove_code_from_spree_promotions.rb')
|
|
5
|
-
|
|
6
|
-
RSpec.describe RemoveCodeFromSpreePromotions do
|
|
7
|
-
let(:migrations_paths) { ActiveRecord::Migrator.migrations_paths }
|
|
8
|
-
let(:migrations) do
|
|
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')
|
|
15
|
-
ActiveRecord::MigrationContext.new(migrations_paths).migrations
|
|
16
|
-
else
|
|
17
|
-
ActiveRecord::Migrator.migrations(migrations_paths)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
let(:previous_version) { 20180710170104 }
|
|
21
|
-
let(:current_version) { 20190106184413 }
|
|
22
|
-
|
|
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
|
|
30
|
-
|
|
31
|
-
# This is needed for MySQL since it is not able to rollback to the previous
|
|
32
|
-
# state when database schema changes within that transaction.
|
|
33
|
-
before(:all) { self.use_transactional_tests = false }
|
|
34
|
-
after(:all) { self.use_transactional_tests = true }
|
|
35
|
-
|
|
36
|
-
around do |example|
|
|
37
|
-
DatabaseCleaner.clean_with(:truncation)
|
|
38
|
-
# Silence migrations output in specs report.
|
|
39
|
-
ActiveRecord::Migration.suppress_messages do
|
|
40
|
-
# Migrate back to the previous version
|
|
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
|
|
46
|
-
# If other tests using Spree::Promotion ran before this one, Rails has
|
|
47
|
-
# stored information about table's columns and we need to reset those
|
|
48
|
-
# since the migration changed the database structure.
|
|
49
|
-
Spree::Promotion.reset_column_information
|
|
50
|
-
|
|
51
|
-
example.run
|
|
52
|
-
|
|
53
|
-
# Re-update column information after the migration has been executed
|
|
54
|
-
# again in the example. This will make the promotion attributes cache
|
|
55
|
-
# ready for other tests.
|
|
56
|
-
Spree::Promotion.reset_column_information
|
|
57
|
-
end
|
|
58
|
-
DatabaseCleaner.clean_with(:truncation)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
let(:promotion_with_code) { create(:promotion) }
|
|
62
|
-
|
|
63
|
-
before do
|
|
64
|
-
# We can't set code via factory since `code=` is currently raising
|
|
65
|
-
# an error, see more at:
|
|
66
|
-
# https://github.com/solidusio/solidus/blob/cf96b03eb9e80002b69736e082fd485c870ab5d9/core/app/models/spree/promotion.rb#L65
|
|
67
|
-
promotion_with_code.update_column(:code, code)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
context 'when there are no promotions with code' do
|
|
71
|
-
let(:code) { '' }
|
|
72
|
-
|
|
73
|
-
it 'does not call any promotion with code handler' do
|
|
74
|
-
expect(described_class).not_to receive(:promotions_with_code_handler)
|
|
75
|
-
|
|
76
|
-
subject
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
context 'when there are promotions with code' do
|
|
81
|
-
let(:code) { 'Just An Old Promo Code' }
|
|
82
|
-
|
|
83
|
-
context 'with the deafult handler (Solidus::Migrations::PromotionWithCodeHandlers::RaiseException)' do
|
|
84
|
-
it 'raise a StandardError exception' do
|
|
85
|
-
expect { subject }.to raise_error(StandardError)
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
context 'changing the default handler' do
|
|
90
|
-
before do
|
|
91
|
-
allow(described_class)
|
|
92
|
-
.to receive(:promotions_with_code_handler)
|
|
93
|
-
.and_return(promotions_with_code_handler)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
context 'to Solidus::Migrations::PromotionWithCodeHandlers::MoveToSpreePromotionCode' do
|
|
97
|
-
let(:promotions_with_code_handler) { Solidus::Migrations::PromotionWithCodeHandlers::MoveToSpreePromotionCode }
|
|
98
|
-
|
|
99
|
-
context 'when there are no Spree::PromotionCode with the same value' do
|
|
100
|
-
it 'moves the code into a Spree::PromotionCode' do
|
|
101
|
-
migration_context = double('a migration context')
|
|
102
|
-
allow_any_instance_of(promotions_with_code_handler)
|
|
103
|
-
.to receive(:migration_context)
|
|
104
|
-
.and_return(migration_context)
|
|
105
|
-
|
|
106
|
-
expect(migration_context)
|
|
107
|
-
.to receive(:say)
|
|
108
|
-
.with("Creating Spree::PromotionCode with value 'just an old promo code' for Spree::Promotion with id '#{promotion_with_code.id}'")
|
|
109
|
-
|
|
110
|
-
expect { subject }
|
|
111
|
-
.to change { Spree::PromotionCode.all.size }
|
|
112
|
-
.from(0)
|
|
113
|
-
.to(1)
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
context 'with promotions with type set (legacy feature)' do
|
|
118
|
-
let(:promotion_with_code) { create(:promotion, type: 'Spree::Promotion') }
|
|
119
|
-
|
|
120
|
-
it 'does not raise a STI error' do
|
|
121
|
-
expect { subject }.not_to raise_error
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
context 'when there is a Spree::PromotionCode with the same value' do
|
|
126
|
-
context 'associated with the same promotion' do
|
|
127
|
-
let!(:existing_promotion_code) { create(:promotion_code, value: 'just an old promo code', promotion: promotion_with_code) }
|
|
128
|
-
|
|
129
|
-
it 'does not create a new Spree::PromotionCode' do
|
|
130
|
-
expect { subject }.not_to change { Spree::PromotionCode.all.size }
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
context 'associated with another promotion' do
|
|
135
|
-
let!(:existing_promotion_code) { create(:promotion_code, value: 'just an old promo code') }
|
|
136
|
-
|
|
137
|
-
it 'raises an exception' do
|
|
138
|
-
expect { subject }.to raise_error(StandardError)
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
context 'to Solidus::Migrations::PromotionWithCodeHandlers::DoNothing' do
|
|
145
|
-
let(:promotions_with_code_handler) { Solidus::Migrations::PromotionWithCodeHandlers::DoNothing }
|
|
146
|
-
|
|
147
|
-
it 'just prints a message' do
|
|
148
|
-
migration_context = double('a migration context')
|
|
149
|
-
allow_any_instance_of(promotions_with_code_handler)
|
|
150
|
-
.to receive(:migration_context)
|
|
151
|
-
.and_return(migration_context)
|
|
152
|
-
|
|
153
|
-
expect(migration_context)
|
|
154
|
-
.to receive(:say)
|
|
155
|
-
.with("Code 'Just An Old Promo Code' is going to be removed from Spree::Promotion with id '#{promotion_with_code.id}'")
|
|
156
|
-
|
|
157
|
-
subject
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rails_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe Spree::Order, type: :model do
|
|
6
|
-
let(:order) { create(:order) }
|
|
7
|
-
|
|
8
|
-
context "#update!" do
|
|
9
|
-
context "when there are update hooks", partial_double_verification: false do
|
|
10
|
-
before { Spree::Order.register_update_hook :foo }
|
|
11
|
-
after { Spree::Order.update_hooks.clear }
|
|
12
|
-
it "should call each of the update hooks" do
|
|
13
|
-
expect(order).to receive :foo
|
|
14
|
-
order.recalculate
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|