2017-02-28 15:50:57 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Dashboard Projects', feature: true do
|
2017-03-13 08:24:06 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, name: "awesome stuff") }
|
2017-05-28 04:29:52 -04:00
|
|
|
let(:project2) { create(:project, :public, name: 'Community project') }
|
2017-03-13 08:24:06 -04:00
|
|
|
|
2017-02-28 15:50:57 -05:00
|
|
|
before do
|
2017-03-13 08:24:06 -04:00
|
|
|
project.team << [user, :developer]
|
2017-05-28 04:29:52 -04:00
|
|
|
login_as(user)
|
2017-02-28 15:50:57 -05:00
|
|
|
end
|
2017-03-13 08:24:06 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-06-03 22:40:59 -04:00
|
|
|
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
|
|
|
|
|
2017-05-28 04:29:52 -04:00
|
|
|
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
|
|
|
|
|
2017-03-30 03:15:42 -04:00
|
|
|
describe "with a pipeline", redis: true do
|
|
|
|
let!(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha) }
|
2017-03-13 08:24:06 -04:00
|
|
|
|
|
|
|
before do
|
2017-03-30 03:15:42 -04:00
|
|
|
# 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
|
2017-03-13 08:24:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows that the last pipeline passed' do
|
|
|
|
visit dashboard_projects_path
|
2017-03-30 03:15:42 -04:00
|
|
|
|
2017-03-13 08:24:06 -04:00
|
|
|
expect(page).to have_xpath("//a[@href='#{pipelines_namespace_project_commit_path(project.namespace, project, project.commit)}']")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-05-23 16:20:53 -04:00
|
|
|
it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token"
|
2017-02-28 15:50:57 -05:00
|
|
|
end
|