mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Display order cycle distributors on product details page
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
%tbody
|
||||
- order = current_order(false)
|
||||
- validator = DistributorChangeValidator.new(order)
|
||||
- @product.distributors.each do |distributor|
|
||||
- Enterprise.distributing_product(@product).each do |distributor|
|
||||
- if !order.nil? && distributor == order.distributor
|
||||
%tr.odd
|
||||
%td
|
||||
@@ -27,4 +27,3 @@
|
||||
%tr.even
|
||||
%td= link_to distributor.name, [main_app, distributor]
|
||||
%td
|
||||
|
||||
@@ -11,15 +11,18 @@ feature %q{
|
||||
scenario "viewing a product shows its supplier and distributor" do
|
||||
# Given a product with a supplier and distributor
|
||||
s = create(:supplier_enterprise)
|
||||
d = create(:distributor_enterprise)
|
||||
p = create(:product, :supplier => s, :distributors => [d])
|
||||
d1 = create(:distributor_enterprise)
|
||||
d2 = create(:distributor_enterprise)
|
||||
p = create(:product, :supplier => s, :distributors => [d1])
|
||||
oc = create(:simple_order_cycle, :distributors => [d2], :variants => [p.master])
|
||||
|
||||
# When I view the product
|
||||
visit spree.product_path p
|
||||
|
||||
# Then I should see the product's supplier and distributor
|
||||
page.should have_selector 'td', :text => s.name
|
||||
page.should have_selector 'td', :text => d.name
|
||||
page.should have_selector 'td', :text => d1.name
|
||||
page.should have_selector 'td', :text => d2.name
|
||||
end
|
||||
|
||||
describe "viewing distributor details" do
|
||||
|
||||
Reference in New Issue
Block a user