diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2017-08-24 08:20:36 +0200 |
---|---|---|
committer | Jan Provaznik <jan.provaznik@gmail.com> | 2017-12-05 08:41:58 +0100 |
commit | 8cce70730c2fb9c705e1f1177f6d1effc665b3c7 (patch) | |
tree | 658e5a0f245159944f7aefc8155627c29b918d1d /spec/controllers/projects_controller_spec.rb | |
parent | a1cd9be42910c89192e82659c09bf0242c8e5dae (diff) | |
download | gitlab-ce-8cce70730c2fb9c705e1f1177f6d1effc665b3c7.tar.gz |
Create merge request from email
* new merge request can be created by sending an email to the specific
email address (similar to creating issues by email)
* for the first iteration, source branch must be specified in the mail
subject, other merge request parameters can not be set yet
* user should enable "Receive notifications about your own activity" in
user settings to receive a notification about created merge request
Part of #32878
Diffstat (limited to 'spec/controllers/projects_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects_controller_spec.rb | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index e7ab714c550..c5c5c125dfd 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -405,11 +405,12 @@ describe ProjectsController do end end - describe 'PUT #new_issue_address' do + describe 'PUT #new_issuable_address for issue' do subject do - put :new_issue_address, + put :new_issuable_address, namespace_id: project.namespace, - id: project + id: project, + issuable_type: 'issue' user.reload end @@ -428,7 +429,35 @@ describe ProjectsController do end it 'changes projects new issue address' do - expect { subject }.to change { project.new_issue_address(user) } + expect { subject }.to change { project.new_issuable_address(user, 'issue') } + end + end + + describe 'PUT #new_issuable_address for merge request' do + subject do + put :new_issuable_address, + namespace_id: project.namespace, + id: project, + issuable_type: 'merge_request' + user.reload + end + + before do + sign_in(user) + project.team << [user, :developer] + allow(Gitlab.config.incoming_email).to receive(:enabled).and_return(true) + end + + it 'has http status 200' do + expect(response).to have_http_status(200) + end + + it 'changes the user incoming email token' do + expect { subject }.to change { user.incoming_email_token } + end + + it 'changes projects new merge request address' do + expect { subject }.to change { project.new_issuable_address(user, 'merge_request') } end end |