From 56f6c6ac1636cd1131eea8c619205d4e8344223d Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Mon, 13 Mar 2017 13:24:06 +0100 Subject: [PATCH] Test showing pipelines on the dashboard --- ...che-default-branch-pipeline-on-project.yml | 4 +++ spec/features/dashboard/projects_spec.rb | 26 +++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/27376-cache-default-branch-pipeline-on-project.yml diff --git a/changelogs/unreleased/27376-cache-default-branch-pipeline-on-project.yml b/changelogs/unreleased/27376-cache-default-branch-pipeline-on-project.yml new file mode 100644 index 00000000000..a116c68ad87 --- /dev/null +++ b/changelogs/unreleased/27376-cache-default-branch-pipeline-on-project.yml @@ -0,0 +1,4 @@ +--- +title: Speed up project dashboard by caching pipeline status and eager loading routes +merge_request: 9903 +author: diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 63eb5c697c2..c4e58d14f75 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -1,10 +1,32 @@ require 'spec_helper' RSpec.describe 'Dashboard Projects', feature: true do + let(:user) { create(:user) } + let(:project) { create(:project, name: "awesome stuff") } + before do - login_as(create :user) + project.team << [user, :developer] + login_as user visit dashboard_projects_path end - + + 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 + + describe "with a pipeline" do + let(:pipeline) { create(:ci_pipeline, :success, project: project, sha: project.commit.sha) } + + before do + pipeline + end + + it 'shows that the last pipeline passed' do + visit dashboard_projects_path + expect(page).to have_xpath("//a[@href='#{pipelines_namespace_project_commit_path(project.namespace, project, project.commit)}']") + end + end + it_behaves_like "an autodiscoverable RSS feed with current_user's private token" end