diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-01-27 15:23:09 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-01-27 15:23:09 +0100 |
commit | ac5b3ce02aa38df94b808d70aa06c7bc18e19701 (patch) | |
tree | a41d8a2fcdcc34df165e2edfb03ca56a7778b5d0 /spec/controllers/projects/commit_controller_spec.rb | |
parent | 30c73d2d9fd6981b817fc5aec5ae6ea5792a7bbe (diff) | |
download | gitlab-ce-ac5b3ce02aa38df94b808d70aa06c7bc18e19701.tar.gz |
Add controller tests for commit pipelines endpoint
Diffstat (limited to 'spec/controllers/projects/commit_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/commit_controller_spec.rb | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb index a95cfc5c6be..ebd2d0e092b 100644 --- a/spec/controllers/projects/commit_controller_spec.rb +++ b/spec/controllers/projects/commit_controller_spec.rb @@ -4,7 +4,6 @@ describe Projects::CommitController do let(:project) { create(:project, :repository) } 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) } @@ -322,11 +321,26 @@ describe Projects::CommitController do 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) + context 'when the commit has pipelines' do + before do + create(:ci_pipeline, project: project, sha: commit.id) + end + + context 'when rendering a HTML format' do + it 'shows pipelines' do + get_pipelines(id: commit.id) + + expect(response).to be_ok + end + end - expect(response).to be_ok + context 'when rendering a JSON format' do + it 'responds with serialized pipelines' do + get_pipelines(id: commit.id, format: :json) + + expect(response).to be_ok + expect(JSON.parse(response.body)).not_to be_empty + end end end end |