summaryrefslogtreecommitdiff
path: root/spec/controllers/projects
diff options
context:
space:
mode:
authormicael.bergeron <micaelbergeron@gmail.com>2017-11-08 15:39:29 -0500
committermicael.bergeron <micaelbergeron@gmail.com>2017-12-07 09:01:23 -0500
commit142edf0afcb83f220175d02ea74b71d90753a875 (patch)
treeaf1bd5a3edaec72705688deb21f87bd33366b882 /spec/controllers/projects
parente4eba908cd85c3ad7b9861c3edbd3c81623242a0 (diff)
downloadgitlab-ce-142edf0afcb83f220175d02ea74b71d90753a875.tar.gz
diff notes created in merge request on a commit have the right context
add a spec for commit merge request diff notes
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/commit_controller_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb
index fd90c0d8bad..a5b603d6bff 100644
--- a/spec/controllers/projects/commit_controller_spec.rb
+++ b/spec/controllers/projects/commit_controller_spec.rb
@@ -132,6 +132,21 @@ describe Projects::CommitController do
expect(response).to be_success
end
end
+
+ context 'in the context of a merge_request' do
+ let(:merge_request) { create(:merge_request, source_project: project) }
+ let(:commit) { merge_request.commits.first }
+
+ it 'prepare diff notes in the context of the merge request' do
+ go(id: commit.id, merge_request_iid: merge_request.iid)
+
+ expect(assigns(:new_diff_note_attrs)).to eq({ noteable_type: 'MergeRequest',
+ noteable_id: merge_request.id,
+ commit_id: commit.id
+ })
+ expect(response).to be_ok
+ end
+ end
end
describe 'GET branches' do