mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
Order cycle can have the same enterprise participating as supplier, coordinator and distributor
This commit is contained in:
@@ -13,13 +13,17 @@ describe Exchange do
|
||||
end
|
||||
end
|
||||
|
||||
it "should not be valid when sender and receiver pair are not unique for its order cycle" do
|
||||
it "should not be valid when (sender, receiver, direction) set are not unique for its order cycle" do
|
||||
e1 = create(:exchange)
|
||||
|
||||
e2 = build(:exchange,
|
||||
:order_cycle => e1.order_cycle, :sender => e1.sender, :receiver => e1.receiver)
|
||||
:order_cycle => e1.order_cycle, :sender => e1.sender, :receiver => e1.receiver, :incoming => e1.incoming)
|
||||
e2.should_not be_valid
|
||||
|
||||
e2.incoming = !e2.incoming
|
||||
e2.should be_valid
|
||||
e2.incoming = !e2.incoming
|
||||
|
||||
e2.receiver = create(:enterprise)
|
||||
e2.should be_valid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user