From 9bb49bb59005dc2707ab805690010e8d5d7a3242 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Mon, 18 Jan 2021 17:13:21 +0100 Subject: [PATCH] Ensure the query the class depends on is called --- spec/queries/customers_with_balance_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/queries/customers_with_balance_spec.rb b/spec/queries/customers_with_balance_spec.rb index fefd1d9090..7942e36060 100644 --- a/spec/queries/customers_with_balance_spec.rb +++ b/spec/queries/customers_with_balance_spec.rb @@ -9,6 +9,14 @@ describe CustomersWithBalance do let(:customer) { create(:customer) } let(:total) { 200.00 } let(:order_total) { 100.00 } + let(:outstanding_balance) { instance_double(OutstandingBalance) } + + it 'calls CustomersWithBalance#statement' do + allow(OutstandingBalance).to receive(:new).and_return(outstanding_balance) + expect(outstanding_balance).to receive(:statement) + + customers_with_balance.query + end context 'when orders are in cart state' do before do