Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-04-11 16:54:55 +0300
committerRémy Coutable <remy@rymai.me>2018-04-11 16:54:55 +0300
commit28bae3b6bc35d760f51577b30a790c7d3d186588 (patch)
treec69a34fdc41d476ca3ea568a9820617b1c035d79 /spec/features
parentf16c6269e1ad3f7acfb63ad8a622248eaced271c (diff)
Resolve "tree/master shows incorrect CI build status"
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/dashboard/projects_spec.rb4
-rw-r--r--spec/features/projects/files/user_reads_pipeline_status_spec.rb46
2 files changed, 48 insertions, 2 deletions
diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb
index 986f864f0b5..257a3822503 100644
--- a/spec/features/dashboard/projects_spec.rb
+++ b/spec/features/dashboard/projects_spec.rb
@@ -89,7 +89,7 @@ feature 'Dashboard Projects' do
end
describe 'with a pipeline', :clean_gitlab_redis_shared_state do
- let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha) }
+ let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha, ref: project.default_branch) }
before do
# Since the cache isn't updated when a new pipeline is created
@@ -102,7 +102,7 @@ feature 'Dashboard Projects' do
visit dashboard_projects_path
page.within('.controls') do
- expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit)}']")
+ expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']")
expect(page).to have_css('.ci-status-link')
expect(page).to have_css('.ci-status-icon-success')
expect(page).to have_link('Commit: passed')
diff --git a/spec/features/projects/files/user_reads_pipeline_status_spec.rb b/spec/features/projects/files/user_reads_pipeline_status_spec.rb
new file mode 100644
index 00000000000..2fb9da2f0a2
--- /dev/null
+++ b/spec/features/projects/files/user_reads_pipeline_status_spec.rb
@@ -0,0 +1,46 @@
+require 'spec_helper'
+
+describe 'user reads pipeline status', :js do
+ let(:project) { create(:project, :repository) }
+ let(:user) { create(:user) }
+ let(:v110_pipeline) { create_pipeline('v1.1.0', 'success') }
+ let(:x110_pipeline) { create_pipeline('x1.1.0', 'failed') }
+
+ before do
+ project.add_master(user)
+
+ project.repository.add_tag(user, 'x1.1.0', 'v1.1.0')
+ v110_pipeline
+ x110_pipeline
+
+ sign_in(user)
+ end
+
+ shared_examples 'visiting project tree' do
+ scenario 'sees the correct pipeline status' do
+ visit project_tree_path(project, expected_pipeline.ref)
+ wait_for_requests
+
+ page.within('.blob-commit-info') do
+ expect(page).to have_link('', href: project_pipeline_path(project, expected_pipeline))
+ expect(page).to have_selector(".ci-status-icon-#{expected_pipeline.status}")
+ end
+ end
+ end
+
+ it_behaves_like 'visiting project tree' do
+ let(:expected_pipeline) { v110_pipeline }
+ end
+
+ it_behaves_like 'visiting project tree' do
+ let(:expected_pipeline) { x110_pipeline }
+ end
+
+ def create_pipeline(ref, status)
+ create(:ci_pipeline,
+ project: project,
+ ref: ref,
+ sha: project.commit(ref).sha,
+ status: status)
+ end
+end