Commit Graph

78 Commits

Author SHA1 Message Date
Maikel Linke
1d2115766a Show product groups to platform user
I removed the caching of `managed_enterprises` in Permissions because
it's just a scope and calling it again is very cheap. And that makes the
method a lot easier to read now that we have a conditional here.

Accessing the managed enterprises via the user instead of a separate
scope on the Enterprise model also reduce the SQL queries. We may want
to use this method in more places. I prefer to keep the
admin-conditional in a permissions class instead of in the model.
2025-08-13 15:06:31 +10:00
Maikel Linke
8e1fb76327 Style Metrics/ModuleLength in spec file
Best viewed without whitespace changes.
2025-06-16 16:13:11 +10:00
cyrillefr
60413c2a12 Fixes RSpecRails InferredSpecType offenses in controller admin 2025-05-20 12:45:34 +02:00
cyrillefr
b9e1eb2984 Fixes RSpecRails HaveHttpStatus cop in admin specs 2025-05-14 10:28:57 +02:00
Hartani Yassir
ace735b230 Merge branch 'master' into 12620-fix-rubocop-rails-response-parse-body 2025-01-31 11:23:15 +01:00
Hartani Yassir
bd41426aef fix rubocop Rails/ResponseParseBody 2025-01-31 10:47:03 +01:00
Maikel Linke
d49cea5e3d Use admin flag instead of user role 2025-01-22 14:59:49 +11:00
Maikel Linke
5db8cb452e Leverage Rails' caching when checking for admin
The privileges of a user should never change within a request
life cycle. The `spree_roles` association is very small, between 0 and 2
items are quickly searched in memory without the need of additional
database queries.

From memory, I've seen a lot of spree_roles queries in log files per
request. This should reduce it to one.
2024-12-19 10:12:31 +11:00
wandji20
4d222c61c6 Improve readability of order_cycle_set process method 2024-08-22 22:17:12 +01:00
wandji20
d599cf77a2 Fix failing specs 2024-08-22 22:17:12 +01:00
Gaetan Craig-Riou
b13a1e8843 Fix order cycle controller spec 2024-07-03 10:17:49 +10:00
Maikel Linke
6317fe1b71 Disable RSpec monkey patching 2024-05-09 12:24:41 +10:00
Feruz Oripov
9d919938f3 Group Order && OrderCycle related services and specs 2024-03-16 19:07:08 +05:00
Maikel Linke
bd6b0ddbf3 Enforce RSpec expect(..).not_to over to_not 2024-03-07 16:57:54 +11:00
Maikel Linke
60b86e1d64 Replace custom query counter with new gem rspec-sql 2024-03-01 11:44:25 +11:00
David Cook
2107aeded1 Un-safely autocorrect RSpec/ExpectChange 2024-02-23 12:17:09 +11:00
Gaetan Craig-Riou
55d64e1768 Fix rubocop warning 2023-12-04 10:36:53 +11:00
David Cook
a2b8fb5105 Show success messages as.. success. 2023-12-01 16:59:23 +11:00
Neal Chambers
42a6a02353 Fix Style/HashSyntax 2023-09-19 08:25:56 +09:00
Neal Chambers
a4f270bdec Fix Layout/LineLength 2023-08-03 09:49:47 +09:00
Neal Chambers
12aa4f9970 Fix Layout/IndentationStyle 2023-06-08 15:20:04 +10:00
Neal Chambers
940f806e5f Fix Rubocop Layout/LineLength 2023-04-04 09:44:15 +09:00
Jean-Baptiste Bellet
a7644f8e8b Update spec: can edit OC even if variant in subscription has been deleted 2023-03-06 17:12:09 +01:00
cyrillefr
e6c0dd95c4 Remive I18n keys in Admin ctrller specs 2023-02-15 11:08:19 +01:00
Cillian O'Ruanaidh
fbe6dcba7a Remove N+1 query loading tags for each order cycle exchange 2022-11-11 17:01:46 +00:00
Jean-Baptiste Bellet
7ca6434b14 Improve the test to delete a cloned order_cycle 2022-03-04 11:34:19 +01:00
Jean-Baptiste Bellet
5fc7d72b09 Check destroying order_cycle will delete associated coordinator fees 2022-03-03 09:06:38 +01:00
Sebastian Castro
95ff3d7a11 Add automatic_notification field in advanced settings 2021-12-23 20:41:49 +01:00
Monica Sirathanarun
ebaf96ddae Add test and change order_cycle#show to redirect to edit page. 2021-10-19 23:20:54 +07:00
Luis Ramos
23627c5453 Run rubocop -a (safe corrections) removing all exceptions so all possible fixes are applied
9290 issues fixed
2021-06-17 22:19:26 +01:00
Luis Ramos
f62f958a4c Fix rspec syntax 2021-03-26 22:29:50 +00:00
Matt-Yorkley
bd408e02b0 Update OrderCyclesController params usage 2021-03-11 12:19:55 +00:00
Matt-Yorkley
dcecfaea87 Fix params issues in OrderCyclescontroller spec 2021-03-11 12:19:54 +00:00
Luis Ramos
d6a53cb84f Replace spree_get with simple call to get 2021-01-22 22:30:11 +00:00
Luis Ramos
2b8f0abe49 Try some mass auto-correct adding frozen-string-literal to all specs 2020-12-03 06:38:24 -08:00
Luis Ramos
f1a3814c0d Rename login_as_enterprise_user to a more specific name controller_login_as_enterprise_user 2020-07-27 14:44:25 +01:00
Luis Ramos
1af4bf6994 Replace usage of create_enterprise_user with :user factory 2020-07-27 14:44:23 +01:00
Luis Ramos
7ba8c5ace1 Make OC advanced settings work by permitting the extra parameter 2020-07-21 19:44:41 +01:00
Luis Ramos
20c7a0d3ef Adapt to latest changes in order cycles controller strong params changes 2020-03-21 14:45:51 +00:00
Luis Ramos
1a46e7b7ee Improve strong params implementation on order_cycle controller and fix corresponding specs 2020-03-21 14:45:51 +00:00
Matt-Yorkley
53645517af Update deprecated #find_by_* methods 2020-02-22 11:06:51 +00:00
Matt-Yorkley
30558485de Update deprecated #find_or_create_by_* methods 2020-02-22 11:06:51 +00:00
luisramos0
5fdb86ae43 Make simple create redirect to OC list but normal create to jump to incoming settings 2019-11-12 12:00:48 +00:00
luisramos0
86b0d71c7e Result of rubocop auto-correct and rebuilding rubocop_manual_todo 2019-05-28 12:57:29 +01:00
luisramos0
6996353d05 Run transpec for spec/controllers 2019-05-10 01:20:40 +01:00
Kristina Lim
c14e7ea8d5 Allow bulk update of order cycle name 2018-08-16 21:18:24 +08:00
Rob Harrington
25525ae30b Move applicator calls to OrderCycleForm 2018-06-22 09:46:08 +10:00
Rob Harrington
d9830749f1 Extract schedule syncing logic into OrderCycleForm 2018-06-22 09:46:08 +10:00
Rob Harrington
21bd9d2e10 Add basic specs for OrderCyclesController#create 2018-06-22 09:46:08 +10:00
Rob Harrington
7af11da901 Use a SubscriptionsCount query object to provide counts to IndexOrderCycleSerializer 2018-06-20 13:06:06 +10:00