Files
openfoodnetwork/spec/features/admin/authentication_spec.rb
filipefurtad0 6f694e2cab Standardise spec block naming
The `feature` and `scenario` names are aliases only available in feature
specs and not needed. It's confusing to have different names and we can
easily move feature specs to system specs when using standard names.
2021-09-28 08:24:05 +10:00

30 lines
874 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe "Authentication", js: true do
include UIComponentHelper
include AuthenticationHelper
include WebHelper
let(:user) { create(:user, password: "password", password_confirmation: "password") }
let!(:enterprise) { create(:enterprise, owner: user) } # Required for access to admin
it "logging into admin redirects home, then back to admin" do
visit spree.admin_dashboard_path
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_login_button
expect(page).to have_content "DASHBOARD"
expect(page).to have_current_path spree.admin_dashboard_path
expect(page).to have_no_content "CONFIGURATION"
end
it "viewing my account" do
login_to_admin_section
click_link "Account"
expect(page).to have_current_path spree.account_path
end
end