summaryrefslogtreecommitdiff
path: root/spec/features/users/projects_spec.rb
blob: 1d75fe434b04f420ab6b208968554e5428159408 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'spec_helper'

describe 'Projects tab on a user profile', :feature, :js do
  include WaitForAjax

  let(:user) { create(:user) }
  let!(:project) { create(:empty_project, namespace: user.namespace) }
  let!(:project2) { create(:empty_project, namespace: user.namespace) }

  before do
    allow(Project).to receive(:default_per_page).and_return(1)

    login_as(user)

    visit user_path(user)

    page.within('.user-profile-nav') do
      click_link('Personal projects')
    end

    wait_for_ajax
  end

  it 'paginates results' do
    expect(page).to have_content(project2.name)

    click_link('Next')

    expect(page).to have_content(project.name)
  end
end