Make spec more precise and robust - query was finding outgoing instead of incoming exchange

This commit is contained in:
Rohan Mitchell
2013-08-27 10:41:02 +10:00
parent 72136a59ae
commit 9824e1b9c5

View File

@@ -66,10 +66,11 @@ module Spree
it "doesn't show products listed in the incoming exchange only" do
s = create(:supplier_enterprise)
c = create(:distributor_enterprise)
d = create(:distributor_enterprise)
p = create(:product)
oc = create(:simple_order_cycle, coordinator: d, suppliers: [s], distributors: [d])
ex = oc.exchanges.where(receiver_id: oc.coordinator_id).first
oc = create(:simple_order_cycle, coordinator: c, suppliers: [s], distributors: [d])
ex = oc.exchanges.incoming.first
ex.variants << p.master
Product.in_distributor(d).should be_empty