Sha256: a2f6098268e391551a410ad1be5d459a21113039070483ac4e6a5306fbd9af96

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'
include LoginHelpers

describe 'Users', :type => :feature do
#  before { login_user(create(:user, is_admin: true)) }

  describe 'admin user views user details page' do
    let(:user) { create(:user) }
    before { visit admin_answers_user_path(user) }

    it 'displays user details' do
      pending 'needs to be fixed for new engine layout'

      expect(page).to have_content(user.email)
    end

  end

  describe 'admin user creates a new user' do
    before { visit new_admin_answers_user_path }

    it 'successfully creates a user' do
      pending 'needs to be fixed for new engine layout'

      fill_in 'Email', with: 'another@example.com'
      fill_in 'user_password', with: 'Mahalo43'
      fill_in 'user_password_confirmation', with: 'Mahalo43'
      check 'Writer'
      click_button 'Create User'

      expect(page).to have_content('User Details')
      expect(page).to have_content('User was successfully created.')
    end
  end

  describe 'admin user updates an existing user' do
    before { visit edit_admin_answers_user_path(create(:user)) }

    it 'successfully updates an existing user' do
      pending 'needs to be fixed for new engine layout'

      fill_in 'Email', with: 'another@example.com'
      click_button 'Update User'

      expect(page).to have_content('User Details')
      expect(page).to have_content('User was successfully updated')
    end
  end

  describe 'admin user deletes a user' do
    before { visit admin_answers_user_path(create(:user)) }

    it 'successfully destroys a user' do
      pending 'needs to be fixed for new engine layout'

      click_link 'Delete User'

      expect(page).to have_content('User was successfully destroyed.')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
answers-core-0.0.0.2 spec/features/admin_user_spec.rb
answers-core-0.0.0 spec/features/admin_user_spec.rb