summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorTakuya Noguchi <tak.noguchi.iridge@gmail.com>2016-12-27 16:30:52 +0900
committerTakuya Noguchi <tak.noguchi.iridge@gmail.com>2017-01-19 18:04:02 +0900
commit2dd5db749f3bb5458bc09b81077fe91b81298930 (patch)
treeee472c93f592f0035072c8bbca9ad15c3d4419d6 /spec/controllers
parent6c62482144e786f83ed62298e06604e46e93107e (diff)
downloadgitlab-ce-2dd5db749f3bb5458bc09b81077fe91b81298930.tar.gz
Add sorting pipeline for a commit
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/commit_controller_spec.rb38
1 files changed, 35 insertions, 3 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb
index 646b097d74e..0fa06a38d2a 100644
--- a/spec/controllers/projects/commit_controller_spec.rb
+++ b/spec/controllers/projects/commit_controller_spec.rb
@@ -1,9 +1,10 @@
require 'spec_helper'
describe Projects::CommitController do
- let(:project) { create(:project) }
- let(:user) { create(:user) }
- let(:commit) { project.commit("master") }
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+ let(:commit) { project.commit("master") }
+ let(:pipeline) { create(:ci_pipeline, project: project, commit: commit) }
let(:master_pickable_sha) { '7d3b0f7cff5f37573aea97cebfd5692ea1689924' }
let(:master_pickable_commit) { project.commit(master_pickable_sha) }
@@ -309,4 +310,35 @@ describe Projects::CommitController do
end
end
end
+
+ describe 'GET pipelines' do
+ def get_pipelines(extra_params = {})
+ params = {
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param
+ }
+
+ get :pipelines, params.merge(extra_params)
+ end
+
+ context 'when the commit exists' do
+ context 'when the commit has one or more pipelines' do
+ it 'shows pipelines' do
+ get_pipelines(id: commit.id)
+
+ expect(response).to be_ok
+ end
+ end
+ end
+
+ context 'when the commit does not exist' do
+ before do
+ get_pipelines(id: 'e7a412c8da9f6d0081a633a4a402dde1c4694ebd')
+ end
+
+ it 'returns a 404' do
+ expect(response).to have_http_status(404)
+ end
+ end
+ end
end