diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-01 20:06:11 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-02-03 09:43:55 +0000 |
commit | 562b5015edaecb09d1237cba7ed820b95ec425f7 (patch) | |
tree | d70ce4195cf74a9f8e87cc7807940f138ad95cb0 /spec/controllers | |
parent | 921141aebdf70161ecd3b2eb9038d271f5a3331c (diff) | |
download | gitlab-ce-562b5015edaecb09d1237cba7ed820b95ec425f7.tar.gz |
Add basic specs for new merge requests pipelines API
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/merge_requests_controller_spec.rb | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index e019541e74f..e100047579d 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -22,23 +22,35 @@ describe Projects::MergeRequestsController do render_views let(:fork_project) { create(:forked_project_with_submodules) } + before { fork_project.team << [user, :master] } - before do - fork_project.team << [user, :master] + context 'when rendering HTML response' do + it 'renders new merge request widget template' do + submit_new_merge_request + + expect(response).to be_success + end end - it 'renders it' do - get :new, - namespace_id: fork_project.namespace.to_param, - project_id: fork_project.to_param, - merge_request: { - source_branch: 'remove-submodule', - target_branch: 'master' - } + context 'when rendering JSON response' do + it 'renders JSON including serialized pipelines' do + submit_new_merge_request(format: :json) - expect(response).to be_success + expect(json_response).to have_key('pipelines') + expect(response).to be_ok + end end end + + def submit_new_merge_request(format: :html) + get :new, + namespace_id: fork_project.namespace.to_param, + project_id: fork_project.to_param, + merge_request: { + source_branch: 'remove-submodule', + target_branch: 'master' }, + format: format + end end shared_examples "loads labels" do |action| |