Display order cycle distributors on product details page

This commit is contained in:
Rohan Mitchell
2013-04-12 13:18:40 +10:00
parent 6e7ee6481d
commit ff9200ebb8
2 changed files with 7 additions and 5 deletions

View File

@@ -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

View File

@@ -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