diff --git a/app/views/spree/products/_source.html.haml b/app/views/spree/products/_source.html.haml index 0757658c0e..13a9e340ea 100644 --- a/app/views/spree/products/_source.html.haml +++ b/app/views/spree/products/_source.html.haml @@ -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 - \ No newline at end of file diff --git a/spec/features/consumer/product_spec.rb b/spec/features/consumer/product_spec.rb index 1cd5f81574..4c983294b0 100644 --- a/spec/features/consumer/product_spec.rb +++ b/spec/features/consumer/product_spec.rb @@ -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