projects_spec.rb 1.7 KB
Newer Older
1 2 3
require 'spec_helper'

RSpec.describe 'Dashboard Projects', feature: true do
4 5
  let(:user) { create(:user) }
  let(:project) { create(:project, name: "awesome stuff") }
6
  let(:project2) { create(:project, :public, name: 'Community project') }
7

8
  before do
9
    project.team << [user, :developer]
10
    login_as(user)
11
  end
12 13 14 15 16 17

  it 'shows the project the user in a member of in the list' do
    visit dashboard_projects_path
    expect(page).to have_content('awesome stuff')
  end

18 19 20 21 22 23 24 25 26
  it 'shows the last_activity_at attribute as the update date' do
    now = Time.now
    project.update_column(:last_activity_at, now)

    visit dashboard_projects_path

    expect(page).to have_xpath("//time[@datetime='#{now.getutc.iso8601}']")
  end

27 28 29 30 31 32 33 34 35 36 37
  context 'when on Starred projects tab' do
    it 'shows only starred projects' do
      user.toggle_star(project2)

      visit(starred_dashboard_projects_path)

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

38 39
  describe "with a pipeline", redis: true do
    let!(:pipeline) {  create(:ci_pipeline, project: project, sha: project.commit.sha) }
40 41

    before do
42 43 44 45
      # Since the cache isn't updated when a new pipeline is created
      # we need the pipeline to advance in the pipeline since the cache was created
      # by visiting the login page.
      pipeline.succeed
46 47 48 49
    end

    it 'shows that the last pipeline passed' do
      visit dashboard_projects_path
50

51 52 53 54
      expect(page).to have_xpath("//a[@href='#{pipelines_namespace_project_commit_path(project.namespace, project, project.commit)}']")
    end
  end

A
Alexis Reigel 已提交
55
  it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token"
56
end