From 208e3bbadd25599c85adddafb2bd63f382be227c Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Tue, 22 May 2018 10:09:24 +0200 Subject: [PATCH] Ensure non-distributors are listed in dashboard We want to show all enterprises in a single list regardless of their type. --- .../spree/admin/overview/_enterprises.html.haml | 2 +- spec/features/admin/overview_spec.rb | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/views/spree/admin/overview/_enterprises.html.haml b/app/views/spree/admin/overview/_enterprises.html.haml index 7f8e9cce20..5b7cfa056b 100644 --- a/app/views/spree/admin/overview/_enterprises.html.haml +++ b/app/views/spree/admin/overview/_enterprises.html.haml @@ -25,7 +25,7 @@ %span.centered.three.columns = t "spree_admin_enterprises_fees" %div.sixteen.columns.alpha.list - - @enterprises.is_distributor.each do |enterprise| + - @enterprises.each do |enterprise| %a.sixteen.columns.alpha.list-item{ class: "#{cycle('odd','even')}", href: "#{main_app.edit_admin_enterprise_path(enterprise)}" } %span.five.columns.alpha = enterprise.name diff --git a/spec/features/admin/overview_spec.rb b/spec/features/admin/overview_spec.rb index c1119a252e..530363929c 100644 --- a/spec/features/admin/overview_spec.rb +++ b/spec/features/admin/overview_spec.rb @@ -56,19 +56,24 @@ feature %q{ context "with multiple enterprises" do let(:d1) { create(:distributor_enterprise) } let(:d2) { create(:distributor_enterprise) } + let(:non_distributor_enterprise) { create(:enterprise, sells: 'none') } - before :each do + before do @enterprise_user.enterprise_roles.build(enterprise: d1).save @enterprise_user.enterprise_roles.build(enterprise: d2).save + @enterprise_user + .enterprise_roles.build(enterprise: non_distributor_enterprise).save end it "displays information about the enterprise" do visit '/admin' - page.should have_selector ".dashboard_item#enterprises h3", text: "My Enterprises" - page.should have_selector ".dashboard_item#products" - page.should have_selector ".dashboard_item#order_cycles" - page.should have_selector ".dashboard_item#enterprises .list-item", text: d1.name - page.should have_selector ".dashboard_item#enterprises .button.bottom", text: "MANAGE MY ENTERPRISES" + + expect(page).to have_selector ".dashboard_item#enterprises h3", text: "My Enterprises" + expect(page).to have_selector ".dashboard_item#products" + expect(page).to have_selector ".dashboard_item#order_cycles" + expect(page).to have_selector ".dashboard_item#enterprises .list-item", text: d1.name + expect(page).to have_selector ".dashboard_item#enterprises .list-item", text: non_distributor_enterprise.name + expect(page).to have_selector ".dashboard_item#enterprises .button.bottom", text: "MANAGE MY ENTERPRISES" end context "but no products or order cycles" do