Renaming managed_products permissions method to editable_products

This commit is contained in:
Rob Harrington
2015-05-20 15:02:36 +10:00
parent 05131de1ad
commit 01d4cf6ecf
2 changed files with 4 additions and 4 deletions

View File

@@ -106,7 +106,7 @@ module OpenFoodNetwork
Spree::LineItem.where(order_id: editable_orders)
end
def managed_products
def editable_products
managed_enterprise_products_ids = managed_enterprise_products.pluck :id
permitted_enterprise_products_ids = related_enterprise_products.pluck :id
Spree::Product.where('id IN (?)', managed_enterprise_products_ids + permitted_enterprise_products_ids)

View File

@@ -164,7 +164,7 @@ module OpenFoodNetwork
end
end
describe "finding managed products" do
describe "finding editable products" do
let!(:p1) { create(:simple_product) }
let!(:p2) { create(:simple_product) }
@@ -175,12 +175,12 @@ module OpenFoodNetwork
it "returns products produced by managed enterprises" do
permissions.stub(:managed_enterprise_products) { Spree::Product.where(id: p1) }
permissions.managed_products.should == [p1]
permissions.editable_products.should == [p1]
end
it "returns products produced by permitted enterprises" do
permissions.stub(:related_enterprise_products) { Spree::Product.where(id: p2) }
permissions.managed_products.should == [p2]
permissions.editable_products.should == [p2]
end
end