diff --git a/spec/features/admin/cms_spec.rb b/spec/features/admin/cms_spec.rb index a01ce78101..29fc2412e2 100644 --- a/spec/features/admin/cms_spec.rb +++ b/spec/features/admin/cms_spec.rb @@ -28,6 +28,6 @@ feature %q{ login_to_consumer_section visit cms_admin_path page.should_not have_content "ComfortableMexicanSofa" - page.should have_content "WHERE WOULD YOU LIKE TO SHOP?" + current_path.should == root_path end end diff --git a/spec/features/consumer/home_spec.rb b/spec/features/consumer/home_spec.rb index 995de43021..411bb701b7 100644 --- a/spec/features/consumer/home_spec.rb +++ b/spec/features/consumer/home_spec.rb @@ -1,49 +1,35 @@ require 'spec_helper' feature 'Home', js: true do + include AuthenticationWorkflow + include UIComponentHelper + let(:distributor) { create(:distributor_enterprise) } + let(:d1) { create(:distributor_enterprise) } + let(:d2) { create(:distributor_enterprise) } + let(:order_cycle) { create(:order_cycle, distributors: [distributor], coordinator: create(:distributor_enterprise)) } before do distributor + order_cycle visit "/" end it "shows all hubs" do page.should have_content distributor.name - find("hub a.row").click + open_active_table_row page.should have_content "Shop at #{distributor.name}" end - pending "should grey out hubs that are not in an order cycle" do - create(:simple_order_cycle, distributors: [d1, d3]) + it "should grey out hubs that are not in an order cycle" do create(:simple_product, distributors: [d1, d2]) - visit root_path - - page.should have_selector 'a.shop-distributor.active', text: 'Murandaka' - page.should have_selector 'a.shop-distributor.inactive', text: 'Ballantyne' - page.should have_selector 'a.shop-distributor.active', text: "O'Hea Street" - page.should have_selector 'a.shop-distributor.inactive', text: 'PepperTree Place' + page.should have_selector 'hub.inactive', text: d1.name + page.should have_selector 'hub.inactive', text: d2.name end - pending "should link to the hub page" do - click_on 'Murandaka' + it "should link to the hub page" do + open_active_table_row + click_on "Shop at #{distributor.name}" current_path.should == "/shop" end - - describe "account links" do - it "should display log in and sign up links when signed out" do - page.should have_link 'Login' - page.should have_link 'Sign Up' - end - - it "should not display links when signed in" do - login_to_consumer_section - visit root_path - - #page.should_not have_link 'Login' - page.should_not have_selector('#sidebarLoginButton', visible: true) - page.should_not have_selector('#sidebarSignUpButton', visible: true) - #page.should_not have_link 'Sign Up' - end - end end diff --git a/spec/features/consumer/landing_page_spec.rb b/spec/features/consumer/landing_page_spec.rb index a936cc1624..474e3ff922 100644 --- a/spec/features/consumer/landing_page_spec.rb +++ b/spec/features/consumer/landing_page_spec.rb @@ -15,7 +15,8 @@ feature %q{ page.should have_selector "#suburb_search" end - describe "suburb search" do + # PENDING - we're not using this anymore + pending "suburb search" do before(:each) do state_id_vic = Spree::State.where(abbr: "Vic").first.id Suburb.create(name: "Camberwell", postcode: 3124, latitude: -37.824818, longitude: 145.057957, state_id: state_id_vic) @@ -23,14 +24,10 @@ feature %q{ it "should auto complete suburbs" do suburb_search_field_id = "suburb_search" - fill_in suburb_search_field_id, :with => "Cambe" - page.execute_script %Q{ $('##{suburb_search_field_id}').trigger("focus") } page.execute_script %Q{ $('##{suburb_search_field_id}').trigger("keydown") } - sleep 1 - page.should have_content("Camberwell") page.should have_content("3124") end