Pau Perez
398467e7ed
Hide new balance impl. under feature toggle
...
This makes it possible to deploy it without releasing it to users since
the toggle is not enabled for anyone.
It aims to make the balance calculation consistent across pages.
2021-01-11 15:50:19 +01:00
Pau Perez
46d997406a
Filter out cart orders when fetching customers
...
We only care about non-cart orders and skipping carts, saves PostgreSQL
query planner to go through thousands of records in production use cases
(my food hub).
We go from
```sql
-> Index Scan using index_spree_orders_on_customer_id on spree_orders (cost=0.42..12049.45 rows=152002 width=15) (actual time=0.015..11.703 rows=13867 loops=1)
```
to
```sql
-> Index Scan using index_spree_orders_on_customer_id on spree_orders (cost=0.42..12429.46 rows=10802 width=15) (actual time=0.025..17.705 rows=9954 loops=1)
```
2021-01-11 15:50:19 +01:00
Pau Perez
96a91969c9
Extract balance-specific serializer
...
So we only show the customer balance where really needed. Aggregating
the balance can be costly. Also, we avoid defensive coding.
2021-01-11 15:50:19 +01:00
Pau Perez
d62ab06504
Refactor DB query to aggregate customer balance
...
It's simpler and many orders of magnitude more efficient to ask the DB
to aggregate the customer balance based on their orders. It removes
a nasty N+1.
The resulting SQL query is:
```sql
SELECT customers.*, SUM(spree_orders.total - spree_orders.payment_total) AS balance
FROM "customers"
INNER JOIN "spree_orders"
ON "spree_orders"."customer_id" = "customers"."id"
WHERE "customers"."enterprise_id" = 1
AND (completed_at IS NOT NULL)
AND (state != 'canceled')
GROUP BY customers.id
ORDER BY email;
```
2021-01-11 15:50:19 +01:00
Matt-Yorkley
04e4893723
Update route declarations in caching spec
2021-01-08 17:47:09 +00:00
Matt-Yorkley
0c9df590d3
Add some improvements to help ensure UI elements are actually loaded by Angular before they are clicked on by Capybara
2021-01-07 14:50:09 +00:00
filipefurtad0
3c123bb947
Simplified the delete test-case
...
Using :xpath may compromise the stability of the test, and make it break upon slight changes to the page.
2021-01-06 16:23:46 +00:00
filipefurtad0
fc062a04a4
Updated the assertion/error to consider PR #6545
2021-01-06 16:23:46 +00:00
filipefurtad0
7f658d4c46
Removed the "_id" ending from objects
...
Renamed objects ":zone_id" and ":tax_category_id" into ":zone" and ":tax_category," as these are full objects and not just ids.
2021-01-06 16:23:46 +00:00
filipefurtad0
8a453abd26
Adding "frozen_string_literal" back to the file
...
Mistakenly removed the line "# frozen_string_literal: true". This commit adds it back in.
2021-01-06 16:23:46 +00:00
filipefurtad0
3edf5fd6d9
Extends spec coverage of Tax Rates settings - CRUD operations
2021-01-06 16:23:46 +00:00
Andy Brett
e58cd8a043
overwrite existing field value
2021-01-05 16:01:04 -08:00
Andy Brett
042b4faf1e
comment out flaky spec
2021-01-02 14:53:55 -08:00
Andy Brett
fc4634cd67
comment out flaky spec
2020-12-29 19:22:09 -08:00
Andy Brett
92aeab2ec3
Merge pull request #6490 from openfoodfoundation/dependabot/bundler/capybara-3.15.1
...
Bump capybara from 2.18.0 to 3.15.1
2020-12-12 13:16:04 -08:00
Luis Ramos
367622cea8
Capybara v3 is not cleaning up the html into text so the permissions that are inside html li elements are not matched with the matcher have_table_row when there are multiple permissions. So, in this case, we need to do the work ourselves: looking up the correct row and then asserting the permissions are the ones required
2020-12-12 00:07:33 +00:00
Luis Ramos
ada25fa2b2
Improve stripe spec
...
I am not sure why this was passing without these stubbed requests for
the second order, but now they were correctly failing. This commit fixes
the spec.
2020-12-11 23:15:08 +00:00
Luis Ramos
480dfdf961
Handle redirect case
...
For some reason the process is now working correctly, the authorization step succeeds and a redirect link is stored in the payment with state pending. The payment state is correctly left at pending. Here we add a check for the redirect path sent by stripe and fail the authorization if there is one (it means the payment would need an extra auth step only available in the frontoffice now and probably through email to customer at some point in the future). For some reason the flash with the authorization failure message is not showing up for the user
2020-12-11 23:14:23 +00:00
Luis Ramos
62715a8060
Adapt matcher to capybara v3
2020-12-11 00:21:46 +00:00
Luis Ramos
26165cc08d
Adapt matcher to capybara v3
2020-12-11 00:20:58 +00:00
Luis Ramos
f19946af8d
Remove unnecessary test step that is breaking in capybara v3
2020-12-11 00:16:31 +00:00
Luis Ramos
c92e8de51f
Adapt matchers to capybara v3
2020-12-11 00:13:46 +00:00
Luis Ramos
ed4a7bd361
Adapt matchers to capybara v3
2020-12-11 00:09:34 +00:00
Luis Ramos
6d37a15488
Adapt matchers to capybara v3
2020-12-11 00:02:22 +00:00
Luis Ramos
b287d67f6b
Adapt matchers to capybara v3
2020-12-10 23:36:40 +00:00
Luis Ramos
5ae955c27f
Adapt matchers to capybara v3
2020-12-10 23:35:34 +00:00
Luis Ramos
fd5adab0d5
Adapt matchers to capybara v3
2020-12-10 23:27:56 +00:00
Luis Ramos
b58fddf098
Adapt matcher to capybara v3
2020-12-10 22:59:37 +00:00
Andy Brett
3d47ad7e33
add stubs for stripe requests
2020-12-08 07:52:42 -08:00
Andy Brett
1f8b4e05bb
allow charges in subscriptions spec
2020-12-08 07:46:10 -08:00
Andy Brett
f875e406a8
update karma specs for setting default card
2020-12-08 07:46:10 -08:00
Matt-Yorkley
0ceba7c0a8
Update orders closing message
2020-12-03 15:29:14 -08:00
Luis Ramos
f71de8123a
Dont show 'closing in' message when oc closes in more than 3 months
2020-12-03 15:29:14 -08:00
Luis Ramos
5b00868c6f
Allow mutable strings in some specs
2020-12-03 06:38:24 -08:00
Luis Ramos
611de912a8
Switch frozen_string_literal to false so that price code keeps working
2020-12-03 06:38:24 -08:00
Luis Ramos
2b8f0abe49
Try some mass auto-correct adding frozen-string-literal to all specs
2020-12-03 06:38:24 -08:00
Andy Brett
936f5c1a0c
remove extraneous page call
2020-12-02 11:38:10 -08:00
Tsara Sudrajat
fb769d37f9
Fix error when setting stock for new product
2020-12-02 11:38:10 -08:00
Matt-Yorkley
7408c45980
Merge pull request #6297 from openfoodfoundation/rails-4-1
...
[Rails 4.1] Merge Rails 4.1 branch into master
2020-12-01 10:56:08 +01:00
Matt-Yorkley
2b2f1ac0cd
Improve specificity of expectation in reset password email test
2020-11-27 14:00:29 +00:00
Matt-Yorkley
60aaf8100a
Fix some Rubocop offences
2020-11-27 14:00:29 +00:00
Matt-Yorkley
2b884be8dd
Update specs to work with ActionMailer::DeliveryJob
2020-11-27 14:00:29 +00:00
Matt-Yorkley
64153c5072
Remove #handle_asyncronously and update to recommended asyncronous devise mail method
2020-11-27 14:00:29 +00:00
Matt-Yorkley
3bfa903912
Revert "Move Spree::Admin::BaseController to Admin::BaseController"
2020-11-27 14:11:57 +01:00
Andy Brett
85d99f3bf2
Merge branch 'master' into controllers
2020-11-20 08:12:03 -08:00
Matt-Yorkley
242c1a2715
Add new Paypal feature spec
2020-11-19 01:44:53 +00:00
Matt-Yorkley
41a5787830
Extract paypal response stubbing to helper
2020-11-18 15:39:01 +00:00
Pau Pérez Fabregat
7c4691ab33
Merge pull request #6339 from andrewpbrett/fix-instance-unit-picker
...
Fix #6304 (Product edit: Cannot change Variant unit scale of an existing product)
2020-11-12 16:15:00 +01:00
Pau Pérez Fabregat
692adb0113
Merge pull request #6336 from coopdevs/fix-shop-layout
...
Fix .top-bar-section not to wrap the icons-menu
2020-11-11 17:29:53 +01:00
Andy Brett
d5037abbe7
add specs for new/edit product pages
2020-11-10 10:49:14 -08:00