diff --git a/app/views/admin/enterprises/index.html.erb b/app/views/admin/enterprises/index.html.erb index 85e662c97f..b2143c97c3 100644 --- a/app/views/admin/enterprises/index.html.erb +++ b/app/views/admin/enterprises/index.html.erb @@ -41,8 +41,10 @@ <%= link_to_with_icon('icon-edit', 'Edit Profile', main_app.edit_admin_enterprise_path(enterprise), class: 'edit') %>
<%= link_to_delete_enterprise enterprise %>
- <%= link_to_with_icon 'icon-chevron-right', 'Payment Methods', spree.admin_payment_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.payment_methods.count %>)
- <%= link_to_with_icon 'icon-plane', 'Shipping Methods', spree.admin_shipping_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.shipping_methods.count %>)
+ <% if enterprise.is_distributor %> + <%= link_to_with_icon 'icon-chevron-right', 'Payment Methods', spree.admin_payment_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.payment_methods.count %>)
+ <%= link_to_with_icon 'icon-plane', 'Shipping Methods', spree.admin_shipping_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.shipping_methods.count %>)
+ <% end %> <%= link_to_with_icon 'icon-money', 'Enterprise Fees', main_app.admin_enterprise_fees_path(enterprise_id: enterprise.id) %> (<%= enterprise.enterprise_fees.count %>) diff --git a/spec/features/admin/enterprises_spec.rb b/spec/features/admin/enterprises_spec.rb index 9e074dcc45..0650c7b664 100644 --- a/spec/features/admin/enterprises_spec.rb +++ b/spec/features/admin/enterprises_spec.rb @@ -17,12 +17,29 @@ feature %q{ end scenario "listing enterprises" do - e = create(:enterprise) + s = create(:supplier_enterprise) + d = create(:distributor_enterprise) login_to_admin_section click_link 'Enterprises' - page.should have_content e.name + within("tr.enterprise-#{s.id}") do + page.should have_content s.name + page.should have_content "Edit Profile" + page.should have_content "Delete" + page.should_not have_content "Payment Methods" + page.should_not have_content "Shipping Methods" + page.should have_content "Enterprise Fees" + end + + within("tr.enterprise-#{d.id}") do + page.should have_content d.name + page.should have_content "Edit Profile" + page.should have_content "Delete" + page.should have_content "Payment Methods" + page.should have_content "Shipping Methods" + page.should have_content "Enterprise Fees" + end end scenario "viewing an enterprise" do