Sha256: d0d2ed50c727a23e71d7180dcf556953a778433baaff6fd4899f4371dd8233c7

Contents?: true

Size: 1.62 KB

Versions: 3

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'


describe "User Profile" do

  before do
    sign_in FactoryGirl.create(:curator)
  end

  context 'when visiting user profile' do
    it 'should render page properly' do
      visit '/users/curator1@example-dot-com'
      expect(page).to have_content('curator1@example.com')
      expect(page).to have_content('Edit Your Profile')
    end
  end

  context 'when clicking all users' do
    it 'should display all users' do
      visit '/users/curator1@example-dot-com'
      click_link 'View Users'
      expect(page).to have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
    end
  end

  context 'when visiting user profile' do
    it 'page should be editable' do
      visit '/users/curator1@example-dot-com'
      click_link 'Edit Your Profile'
      fill_in 'user_twitter_handle', with: 'curatorOfData'
      click_button 'Save Profile'
      expect(page).to have_content 'Your profile has been updated'
      expect(page).to have_content 'curatorOfData'
    end
  end

  context 'user profile' do
    it 'should be searchable' do
      @archivist = FactoryGirl.find_or_create(:archivist)
      visit '/users/curator1@example-dot-com'
      click_link 'View Users'
      expect(page).to have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
      expect(page).to have_xpath("//td/a[@href='/users/archivist1@example-dot-com']")
      fill_in 'user_search', with: 'archivist1@example.com'
      click_button "user_submit"
      expect(page).to_not have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
      expect(page).to have_xpath("//td/a[@href='/users/archivist1@example-dot-com']")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sufia-4.0.1 spec/features/users_spec.rb
sufia-4.0.0 spec/features/users_spec.rb
sufia-4.0.0.rc2 spec/features/users_spec.rb