mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Adding menu helper, removing admin path
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
5
spec/support/request/menu_helper.rb
Normal file
5
spec/support/request/menu_helper.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
module MenuHelper
|
||||
def open_login_modal
|
||||
find(:link, text: "LOG IN").click
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user