Matt-Yorkley
206d9e06ea
Reinstate old logic for adjustments controller
...
Certain types of adjustments (eg enterprise fees) cannot really be changed arbitrarily; when the order is saved and "recalculated" the values will be reset. The adjustments are still shown in the main order edit tab, but are not editable in the adjustments tab.
2021-04-15 14:00:48 +01:00
Maikel
0c182c4606
Merge pull request #7259 from jibees/7193-implements-feature-toggle-with-flipper
...
Implements feature toggle with flipper
2021-04-15 11:33:12 +10:00
Matt-Yorkley
93affe4e82
Remove previous migration test
...
It's outdated now.
2021-04-14 12:01:21 +01:00
Matt-Yorkley
83acc3faac
Improve test setup where checking ineligible payment fee adjustments
2021-04-14 12:01:21 +01:00
Matt-Yorkley
86977da033
Update enterprise fee test setup
2021-04-14 12:01:21 +01:00
Matt-Yorkley
15edb5b13b
Remove more uses of adjustment source association in tests
2021-04-14 12:01:21 +01:00
Matt-Yorkley
e323d016a2
Simplify arguments of #create_adjustment method
2021-04-14 12:01:21 +01:00
Matt-Yorkley
ebce32c57b
Update factory and specs
2021-04-14 12:01:21 +01:00
Matt-Yorkley
b6038c01a3
Remove references to Adjustment source
2021-04-14 12:01:21 +01:00
Luis Ramos
e4a6afab81
Add needed helper to BulkInvoiceRenderer spec
2021-04-13 16:54:32 -07:00
Luis Ramos
ae7e1677f7
Add needed helper to BulkInvoiceService spec
2021-04-13 16:54:32 -07:00
Luis Ramos
f61c04e314
Adapt helpers to make view spec green
2021-04-13 16:54:32 -07:00
Luis Ramos
abd6faf686
Adapt routes and helpers to make view spec green
2021-04-13 16:54:32 -07:00
Luis Ramos
2c05478b2f
Adapt routes and helpers to make view spec green
2021-04-13 16:54:32 -07:00
Luis Ramos
049c2b59ca
Adapt routes and helpers to make view spec green
2021-04-13 16:54:32 -07:00
Matt-Yorkley
ab4660ecd0
Fix callback in Classification and update spec
...
Fixes:
2) Spree::Classification won't destroy if classification is the primary taxon
(Used from /home/runner/work/openfoodnetwork/openfoodnetwork/spec/models/enterprise_group_spec.rb:43:in `block (3 levels) in <top (required)>')
Failure/Error: expect(classification.destroy).to be false
2021-04-13 16:54:32 -07:00
Matt-Yorkley
be6fd23ebc
Fix unpersisted changes in checkout controller specs
...
The test setup left the object with unsaved changes, which doesn't work nicely with the new order locking added recently on the edit action.
Fixes ~5 specs including:
5) CheckoutController redirection to cart and stripe redirects when some items are out of stock
Failure/Error:
order.with_lock do
lock_variants_of(order)
yield
end
RuntimeError:
Locking a record with unpersisted changes is not supported. Use `save` to persist the changes, or `reload` to discard them explicitly.
# ./app/services/current_order_locker.rb:22:in `lock_order_and_variants'
# ./app/services/current_order_locker.rb:11:in `around'
# ./spec/controllers/checkout_controller_spec.rb:57:in `block (3 levels) in <top (required)>'
2021-04-13 16:54:31 -07:00
Matt-Yorkley
fbda3c15ff
Fix deprecated use of #stub in payment spec
...
Fixes:
Using `stub` from rspec-mocks' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` instead. Called from /home/runner/work/openfoodnetwork/openfoodnetwork/spec/models/spree/payment_spec.rb:10:in `block (3 levels) in <top (required)>'.
RuntimeError:
stubbed models are not allowed to access the database - Spree::Product#touch(updated_at,{:time=>2021-04-10 14:24:50 UTC})
2021-04-13 15:50:54 -07:00
Matt-Yorkley
3bce1bad62
Add missing Stripe API request stub
...
The first time the checkout is submitted here it uses the defaults in CheckoutRequestHelper#fill_out_details
2021-04-13 15:41:37 -07:00
Maikel Linke
8a062b05eb
Clarify test users in feature toggle spec
2021-04-12 18:26:18 +02:00
Maikel Linke
f242dc8a19
Spec new #flipper_id method
2021-04-12 18:26:18 +02:00
Maikel Linke
7a0912d5a4
Use Flipper within the OFN FeatureToggle interface
...
This ensures that we keep the same interface as before and can migrate
to Flipper in a backwards-compatible way.
2021-04-12 18:26:18 +02:00
Maikel Linke
b045a59685
Consider feature toggles without user as well
...
This is running the same feature toggle logic when a user is given or no
user is given. This allows features to define what to do with guests.
2021-04-12 18:26:18 +02:00
Andy Brett
a3ac7a7ffd
Merge pull request #7354 from andrewpbrett/uncomment-tag-rule-spec
...
Uncomment out flaky tag rules spec
2021-04-12 08:17:14 -07:00
Pau Perez
5cf4aecc26
Enable customer_balance toggle in tests
...
This makes all tests exercise the new branch that `OrderBalance`
abstracts. It follows up #7363 addressing code review comments.
2021-04-12 09:31:23 +02:00
Andy Brett
e90420b581
Merge pull request #7363 from coopdevs/release-balances-to-all-users
...
Enable customer_balance feature toggle to all users
2021-04-11 21:50:15 -07:00
Andy Brett
d00970e05d
Merge pull request #7207 from andrewpbrett/fix-nil-price-subs
...
Report subscription failures
2021-04-09 12:13:11 -07:00
Pau Perez
95f29e4252
Remove outdated initializer specs
...
These no longer make sense since we're enabling customer_balance
unconditionally.
2021-04-09 10:22:21 +02:00
Pau Pérez Fabregat
92f45badac
Merge pull request #7340 from Matt-Yorkley/deleted-enterprise-fees
...
Add test coverage: deleted enterprise fees
2021-04-09 09:05:11 +02:00
Pau Pérez Fabregat
a902230106
Merge pull request #7316 from Matt-Yorkley/dead-code-shipments
...
DCOTW: #ensure_updated_shipments
2021-04-09 08:03:24 +02:00
Andy Brett
199efb1e20
Merge pull request #7351 from Matt-Yorkley/dead-code-discount-order
...
Dead code: DiscountOrder
2021-04-08 12:48:38 -07:00
jibees
ca36996060
Merge pull request #7314 from Matt-Yorkley/order-payment-amount
...
Rename #charge_shipping_and_payment_fees! to #set_payment_amount!
2021-04-08 21:22:56 +02:00
Andy Brett
48f2ab7ad7
Revert "comment out flaky spec"
...
This reverts commit fc4634cd67 .
2021-04-08 11:07:30 -07:00
Matt-Yorkley
d1755acac5
Merge pull request #7355 from andrewpbrett/rspec-syntax
...
Update rspec syntax
2021-04-08 20:01:48 +02:00
Andy Brett
b78ed85ad3
Merge pull request #7321 from Matt-Yorkley/remove-bugherd
...
Remove Bugherd
2021-04-08 10:35:17 -07:00
Luis Ramos
706b854d8c
Fix rspec syntax
2021-04-08 10:03:11 -07:00
Andy Brett
c3c482c0fe
fix failing spec
...
Another PR introduced a before_action to the controller, so we have to stub that out to avoid the double receiving an unexpected message
2021-04-08 08:53:35 -07:00
Andy Brett
9b3628a4dd
Merge pull request #7299 from andrewpbrett/line-item-fees
...
Update fees after changing a line item
2021-04-08 07:26:34 -07:00
Matt-Yorkley
e1a10db410
Remove :tag_rule factory and update tests to use alternate (valid) factories
2021-04-08 12:37:45 +01:00
Matt-Yorkley
9a4bbacbaa
Update enterprises controller spec to use different (valid) TagRule class
2021-04-08 12:37:19 +01:00
Matt-Yorkley
80d43c714d
Remove TagRule::DiscountOrder
...
This class was removed from the UI in 2016 and hasn't been used since...
2021-04-08 12:37:17 +01:00
Matt-Yorkley
e61fe86d00
Merge pull request #7300 from andrewpbrett/on-demand-max-quantities
...
Allow any quantity if variant is set to on demand
2021-04-08 12:33:19 +02:00
Pau Pérez Fabregat
682cdc4ece
Merge pull request #7349 from andrewpbrett/fix-unit-price-nil-method
...
Guard against variants that use items but have scales
2021-04-08 09:56:48 +02:00
Pau Pérez Fabregat
953454e2fb
Merge pull request #7343 from luisramos0/dead_code_2
...
[Rails 5.2] Remove dead code
2021-04-08 09:48:25 +02:00
Pau Pérez Fabregat
27ac17f95e
Merge pull request #7344 from luisramos0/helpers
...
[Rails 5.2] Fix base helper spec in rails 52
2021-04-08 09:47:49 +02:00
Andy Brett
2128675e95
Merge pull request #7236 from Matt-Yorkley/exchange-deadlocks
...
Update Exchange touch on Enterprise to use #touch_later
2021-04-07 20:54:03 -07:00
Andy Brett
a60b4a41c5
guard against variants that use items but have scales
2021-04-07 18:31:15 -07:00
Maikel Linke
cf22a864f3
Fix typo in spec description
2021-04-08 09:24:39 +10:00
Maikel Linke
bfa5d443f1
Don't change canceled orders
...
We have a PR already that removes the UI for this when the order is
canceled. Implementing it on controller-side makes sure that it doesn't
happen accidentally if the user has multiple tabs open.
2021-04-08 09:24:39 +10:00
Maikel Linke
f0d5bf0ab5
Disallow changes of canceled order
2021-04-08 09:24:39 +10:00