Commit Graph

18 Commits

Author SHA1 Message Date
Gaetan Craig-Riou
2550f8fd80 Fix cached enterprise serializer spec 2024-07-03 11:21:28 +10:00
Maikel Linke
6317fe1b71 Disable RSpec monkey patching 2024-05-09 12:24:41 +10:00
Andy Brett
741ed73cf5 add specs for enterprises with nil or unknown category 2021-02-24 11:43:53 -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
Matt-Yorkley
43ba73ac19 Avoid expensive queries for supplied product properties if enterprise is not a supplier 2020-04-23 21:51:39 +02:00
Matt-Yorkley
3aff7f62e3 Don't query distributed properties on enterprises that aren't active distributors
Cuts page load on /shops by ~75% (with production data) and removes ~300 expensive and superfluous queries.
2020-04-08 20:08:12 +02:00
Matt-Yorkley
c82c54873c Pluck :id when querying active distributors for serializer data 2020-03-23 22:38:55 +01:00
Pau Perez
54e120889f Remove useless array wrapping on AR relation 2019-03-04 11:08:34 +01:00
Pau Perez
e55fbf80fc Check property presentation attribute only in test
The PropertySerializer contains :id, :name and :presentation attributes
which leads to JSON objects like `{"id": 1, "name": "foo",
"presentation": "foo"}`. Because of this, we don't care about object
identity, just about their presentation attribute.
2019-02-26 11:36:36 +01:00
Pau Perez
d4635bd7cb Fetch Property instead of ProducerProps from query
By not having to treat producer properties differently we can filter and
fetch all properties from DB without having to process it with Ruby and
with a single query.
2019-02-26 11:36:36 +01:00
Pau Perez
92e2ed78d1 Test active distributor as well 2019-02-26 11:36:36 +01:00
Pau Perez
47a90e937b Have a duplicate product to test with 2019-02-26 11:36:36 +01:00
Pau Perez
8fef69387e Simplify test setup using factory transient attrs 2019-02-26 11:36:36 +01:00
Pau Perez
0782907f4d Setup a test order cycle with its exchanges 2019-02-26 11:36:36 +01:00
Pau Perez
e0f43191e2 Make helper methods private
Otherwise next dev might think these are attributes of the resulting
JSON serialized object.

They just made the refactoring a bit easier.
2018-11-28 16:21:40 +01:00
Pau Perez
e40c1c08ca Refactor spec to not stub the class under test
This also relies on ActiveRecord which will come in handy as we move on
the refactor.
2018-11-28 16:21:40 +01:00
Pau Perez
149fc1ac6f Inline PropertyMerge's #merge into serializer
Now that it has become a plain Ruby #uniq, there's no point on having
the abstraction and indirection.
2018-11-28 16:21:40 +01:00
Pau Perez
bc7258d43b Test #supplied_properties helper methods 2018-11-28 16:21:40 +01:00