mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix order permission and specs
This commit is contained in:
@@ -83,7 +83,7 @@ module Permissions
|
||||
Spree::Order.with_line_items_variants_and_products_outer.
|
||||
where(
|
||||
distributor_id: granted_distributor_ids,
|
||||
spree_products: { supplier_id: enterprises_with_associated_orders }
|
||||
spree_variants: { supplier_id: enterprises_with_associated_orders }
|
||||
).
|
||||
where_clause.__send__(:predicates).
|
||||
reduce(:and)
|
||||
|
||||
@@ -88,8 +88,8 @@ module Permissions
|
||||
|
||||
context "which contains my products" do
|
||||
before do
|
||||
line_item.product.supplier = producer
|
||||
line_item.product.save
|
||||
line_item.variant.supplier = producer
|
||||
line_item.variant.save
|
||||
end
|
||||
|
||||
it "should let me see the order" do
|
||||
@@ -165,8 +165,8 @@ module Permissions
|
||||
create(:enterprise_relationship, parent: producer, child: distributor,
|
||||
permissions_list: [:add_to_order_cycle])
|
||||
|
||||
line_item1.product.supplier = producer
|
||||
line_item1.product.save
|
||||
line_item1.variant.supplier = producer
|
||||
line_item1.variant.save
|
||||
end
|
||||
|
||||
it "should let me see the line_items pertaining to variants I produce" do
|
||||
|
||||
Reference in New Issue
Block a user