Sha256: eef6f7afdcc822fbc6ea8cfa22adcd335b6319604c61d9c6544c728be9590673

Contents?: true

Size: 1.64 KB

Versions: 15

Compression:

Stored size: 1.64 KB

Contents

describe 'Roles Admin', type: :feature, js: true do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:exhibit_admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
  before do
    login_as exhibit_admin

    visit spotlight.exhibit_dashboard_path(exhibit)
    click_link 'Users'
  end

  it 'informs the admin that a user they are trying to add does not yet exist' do
    expect(page).to have_css('.help-block[data-behavior="no-user-note"]', visible: false)
    expect(page).not_to have_css('input[disabled]')

    click_link 'Add a new user'
    fill_in 'User key', with: 'user@example.com'

    expect(page).to have_css('.help-block[data-behavior="no-user-note"]', visible: true)
    expect(page).to have_link('invite', visible: true)
    expect(page).to have_css('input[disabled]')
  end

  it 'has the appropriate status message when an existing user is added' do
    second_user = FactoryGirl.create(:site_admin)

    click_link 'Add a new user'
    fill_in 'User key', with: second_user.email

    click_button 'Save changes'

    expect(page).to have_css('.alert-info', text: 'User has been updated.')
    expect(page).to have_css('.table.users td', text: second_user.email)
  end

  it 'persists invited users to the exhibits user list' do
    expect(page).not_to have_css('.label-warning pending-label', text: 'pending', visible: true)

    click_link 'Add a new user'
    fill_in 'User key', with: 'user@example.com'
    click_link 'invite'

    within('tr.invite-pending') do
      expect(page).to have_css('td', text: 'user@example.com')
      expect(page).to have_css('.label-warning.pending-label', text: 'pending', visible: true)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
blacklight-spotlight-0.27.0 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.26.1 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.26.0 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.25.0 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.24.0 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.23.0 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.22.0 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.21.0 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.20.3 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.20.2 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.20.1 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.20.0 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.19.2 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.19.1 spec/features/javascript/roles_admin_spec.rb
blacklight-spotlight-0.19.0 spec/features/javascript/roles_admin_spec.rb