From 05f5e5562f0e34bca1ebed148aac809e9400af4f Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 9 May 2014 10:05:09 +1000 Subject: [PATCH] Adding menu helper, removing admin path --- app/views/shared/menu/_large_menu.html.haml | 2 +- app/views/shared/menu/_mobile_menu.html.haml | 2 +- spec/features/consumer/authentication_spec.rb | 39 +++++++++++++------ spec/support/request/menu_helper.rb | 5 +++ 4 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 spec/support/request/menu_helper.rb diff --git a/app/views/shared/menu/_large_menu.html.haml b/app/views/shared/menu/_large_menu.html.haml index 50e01f3976..8f6bf58db5 100644 --- a/app/views/shared/menu/_large_menu.html.haml +++ b/app/views/shared/menu/_large_menu.html.haml @@ -26,7 +26,7 @@ %li.divider - if spree_current_user.andand.has_spree_role? 'admin' %li - %a{href: spree_admin_path} + %a{href: admin_path} %span.nav-primary Admin %li.divider %section.top-bar-section diff --git a/app/views/shared/menu/_mobile_menu.html.haml b/app/views/shared/menu/_mobile_menu.html.haml index 203a72d41a..7042a3dbc5 100644 --- a/app/views/shared/menu/_mobile_menu.html.haml +++ b/app/views/shared/menu/_mobile_menu.html.haml @@ -17,7 +17,7 @@ - if spree_current_user.andand.has_spree_role? 'admin' %li - %a{href: spree_admin_path} + %a{href: admin_path} %span.nav-primary Admin %li - if spree_current_user.nil? diff --git a/spec/features/consumer/authentication_spec.rb b/spec/features/consumer/authentication_spec.rb index e1dd681af6..6a9f85bcbc 100644 --- a/spec/features/consumer/authentication_spec.rb +++ b/spec/features/consumer/authentication_spec.rb @@ -1,22 +1,37 @@ require 'spec_helper' feature "Authentication", js: true do + include MenuHelper describe "login" do let(:user) { create(:user, password: "password", password_confirmation: "password") } - scenario "with valid credentials" do - visit "/login" - fill_in "Email", with: user.email - fill_in "Password", with: "password" - click_button "Login" - current_path.should == "/" + + describe "newskool" do + before do + visit root_path + end + scenario "showing modal" do + binding.pry + find(:link, text: "LOG IN").click + page.should have_content "Forgot Password?" + end end - scenario "with invalid credentials" do - visit "/login" - fill_in "Email", with: user.email - fill_in "Password", with: "this isn't my password" - click_button "Login" - page.should have_content "Invalid email or password" + describe "oldskool" do + scenario "with valid credentials" do + visit "/login" + fill_in "Email", with: user.email + fill_in "Password", with: "password" + click_button "Login" + current_path.should == "/" + end + + scenario "with invalid credentials" do + visit "/login" + fill_in "Email", with: user.email + fill_in "Password", with: "this isn't my password" + click_button "Login" + page.should have_content "Invalid email or password" + end end end end diff --git a/spec/support/request/menu_helper.rb b/spec/support/request/menu_helper.rb new file mode 100644 index 0000000000..9cda5ab117 --- /dev/null +++ b/spec/support/request/menu_helper.rb @@ -0,0 +1,5 @@ +module MenuHelper + def open_login_modal + find(:link, text: "LOG IN").click + end +end