Sha256: 701370bc047145b725ecd73a98c903c14d5c14ce8267fda541809b30969af401

Contents?: true

Size: 1.55 KB

Versions: 17

Compression:

Stored size: 1.55 KB

Contents

RSpec.feature 'Sign In', type: :feature do

  background do
    @user = create(:user, email: 'email@person.com', password: 'secret', password_confirmation: 'secret')
    visit spree.login_path
  end

  scenario 'ask user to sign in' do
    visit spree.admin_path
    expect(page).not_to have_text 'Authorization Failure'
  end

  scenario 'let a user sign in successfully' do
    fill_in 'Email', with: @user.email
    fill_in 'Password', with: @user.password
    click_button 'Login'

    expect(page).to have_text 'Logged in successfully'
    expect(page).not_to have_text 'Login'
    expect(page).to have_text 'Logout'
    expect(current_path).to eq '/'
  end

  scenario 'show validation erros' do
    fill_in 'Email', with: @user.email
    fill_in 'Password', with: 'wrong_password'
    click_button 'Login'

    expect(page).to have_text 'Invalid email or password'
    expect(page).to have_text 'Login'
  end

  scenario 'allow a user to access a restricted page after logging in' do
    user = create(:admin_user, email: 'admin@person.com', password: 'password', password_confirmation: 'password')
    visit spree.admin_path

    fill_in 'Email', with: user.email
    fill_in 'Password', with: user.password
    click_button 'Login'

    expect(page).to have_text 'admin@person.com'
    expect(current_path).to eq '/admin/orders'
  end

  it "should store the user previous location" do
    visit spree.account_path
    fill_in "Email", with: @user.email
    fill_in "Password", with: @user.password
    click_button "Login"
    expect(current_path).to eq "/account"
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
solidus_auth_devise-2.2.0 spec/features/sign_in_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.5 spec/features/sign_in_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.4 spec/features/sign_in_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.3 spec/features/sign_in_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.2 spec/features/sign_in_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.1 spec/features/sign_in_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0 spec/features/sign_in_spec.rb
solidus_auth_devise-2.1.0 spec/features/sign_in_spec.rb
solidus_auth_devise-2.0.0 spec/features/sign_in_spec.rb
solidus_auth_devise-1.6.4 spec/features/sign_in_spec.rb
solidus_auth_devise-1.6.3 spec/features/sign_in_spec.rb
solidus_auth_devise-1.6.2 spec/features/sign_in_spec.rb
solidus_auth_devise-1.6.1 spec/features/sign_in_spec.rb
solidus_auth_devise-1.6.0 spec/features/sign_in_spec.rb
solidus_auth_devise-1.5.0 spec/features/sign_in_spec.rb
solidus_auth_devise-1.4.0 spec/features/sign_in_spec.rb
solidus_auth_devise-1.3.0 spec/features/sign_in_spec.rb