Add test on number of db queries

Hmm, I think I seen an opportunity to clean up already.
This commit is contained in:
David Cook
2024-08-14 17:26:01 +10:00
parent c9daca22d5
commit eb547f4861

View File

@@ -65,6 +65,11 @@ RSpec.describe OpenFoodNetwork::ScopeVariantsForSearch do
let(:params) { { q: "product", distributor_id: d2.id } }
it "returns all products distributed through that distributor" do
expect{ result }.to query_database [
"Enterprise Load", "Enterprise Load", "Enterprise Load", # loads same enterprise three times
"VariantOverride Load",
"SQL"
]
expect(result).to include v4
expect(result).not_to include v1, v2, v3
end