From 2d2e0a5b24b6146b842b40b8f2f72a4636fd4728 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Wed, 8 Sep 2021 12:18:08 +0100 Subject: [PATCH] Add unit test for not_empty scope --- spec/models/spree/order_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index e6b7086e98..defe01ac29 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -849,6 +849,16 @@ describe Spree::Order do expect(Spree::Order.not_state(:canceled)).not_to include o end end + + describe "not_empty" do + let!(:order_with_line_items) { create(:order_with_line_items, line_items_count: 1) } + let!(:order_without_line_items) { create(:order) } + + it "returns only orders which have line items" do + expect(Spree::Order.not_empty).to include order_with_line_items + expect(Spree::Order.not_empty).to_not include order_without_line_items + end + end end describe "sending confirmation emails" do