Sha256: 0a275f91b2496ec2b789944a4c4dde5332db14005ee5105667da13475424ae69

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require 'rails_helper'

feature 'Impersonate user' do
  given(:admin_user) { create(:user, :admin) }
  given(:regular_user) { create(:user) }

  scenario 'With admin privileges' do
    sign_in(admin_user.email, admin_user.password)

    visit impersonate_admin_user_path(id: regular_user.id)

    expect(page).to have_content('Stop Impersonating')
  end

  scenario 'With admin privileges: End Impersonation' do
    sign_in(admin_user.email, admin_user.password)

    visit impersonate_admin_user_path(id: regular_user.id)
    visit stop_impersonating_admin_users_path

    expect(page).to_not have_content('Stop Impersonating')
  end

  scenario 'Without admin privileges' do
    sign_in(regular_user.email, regular_user.password)

    visit impersonate_admin_user_path(id: admin_user.id)

    expect(page).to have_content('You must be an admin to perform that action')
  end

  scenario 'Stop impersonating when not impersonating' do
    visit stop_impersonating_admin_users_path

    expect(page)
      .to have_content('You need to sign in or sign up before continuing.')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
voyage-1.44.0.14 lib/voyage/templates/specs/features/user_impersonation_spec.rb
voyage-1.44.0.13 lib/voyage/templates/specs/features/user_impersonation_spec.rb
voyage-1.44.0.11 lib/voyage/templates/specs/features/user_impersonation_spec.rb
voyage-1.44.0.12 lib/voyage/templates/specs/features/user_impersonation_spec.rb
voyage-1.44.0.10 lib/voyage/templates/specs/features/user_impersonation_spec.rb