require 'spec_helper' feature %q{ As a consumer I want to see a list of producers So that I can shop at hubs distributing their products }, js: true do include UIComponentHelper let!(:producer) { create(:supplier_enterprise) } let!(:invisible_producer) { create(:supplier_enterprise, visible: false) } let(:taxon) { create(:taxon) } let!(:product) { create(:simple_product, supplier: producer, taxons: [taxon]) } let(:shop) { create(:distributor_enterprise) } let!(:er) { create(:enterprise_relationship, parent: shop, child: producer) } before do visit producers_path end it "shows all producers with expandable details" do page.should have_content producer.name expand_active_table_node producer.name page.should have_content producer.supplied_taxons.first.name.split.map(&:capitalize).join(' ') end it "doesn't show invisible producers" do page.should_not have_content invisible_producer.name end it "links to places to buy produce" do expand_active_table_node producer.name page.should have_link shop.name end end