BigW Consortium Gitlab

archived_projects_spec.rb 1.29 KB
Newer Older
1 2
require 'spec_helper'

3
RSpec.describe 'Dashboard Archived Project' do
4 5
  let(:user) { create :user }
  let(:project) { create :project}
6
  let(:archived_project) { create(:project, :archived) }
7 8

  before do
9 10
    project.add_master(user)
    archived_project.add_master(user)
11

12
    sign_in(user)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

    visit dashboard_projects_path
  end

  it 'renders non archived projects' do
    expect(page).to have_link(project.name)
    expect(page).not_to have_link(archived_project.name)
  end

  it 'renders all projects' do
    click_link 'Show archived projects'

    expect(page).to have_link(project.name)
    expect(page).to have_link(archived_project.name)
  end
28

29 30 31 32 33 34 35
  it 'renders only archived projects' do
    click_link 'Show archived projects only'

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

36 37 38 39 40 41 42 43 44 45 46 47 48 49
  it 'searchs archived projects', :js do
    click_button 'Last updated'
    click_link 'Show archived projects'

    expect(page).to have_link(project.name)
    expect(page).to have_link(archived_project.name)

    fill_in 'project-filter-form-field', with: archived_project.name

    find('#project-filter-form-field').native.send_keys :return

    expect(page).not_to have_link(project.name)
    expect(page).to have_link(archived_project.name)
  end
50
end