summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/notes_controller_spec.rb
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2019-02-14 20:22:51 +0800
committerHeinrich Lee Yu <heinrich@gitlab.com>2019-02-23 09:38:58 +0800
commitd03dee26b9d15440ba3d52d319b11474176143c4 (patch)
tree5e4359ed56bdd13da6b00d56ed55930626f1d2d8 /spec/controllers/projects/notes_controller_spec.rb
parent48d31abc97528a36614b545f0b61fa14053ce4a8 (diff)
downloadgitlab-ce-d03dee26b9d15440ba3d52d319b11474176143c4.tar.gz
Refactor params for notes_actions
Removes unneeded params from permitted list This also fixes commenting on commits with a hash starting with a large number
Diffstat (limited to 'spec/controllers/projects/notes_controller_spec.rb')
-rw-r--r--spec/controllers/projects/notes_controller_spec.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb
index 81892575889..0b0f5117784 100644
--- a/spec/controllers/projects/notes_controller_spec.rb
+++ b/spec/controllers/projects/notes_controller_spec.rb
@@ -252,8 +252,8 @@ describe Projects::NotesController do
note: 'some note',
noteable_id: merge_request.id.to_s,
noteable_type: 'MergeRequest',
- merge_request_diff_head_sha: 'sha',
- in_reply_to_discussion_id: nil
+ commit_id: nil,
+ merge_request_diff_head_sha: 'sha'
}).permit!
expect(Notes::CreateService).to receive(:new).with(project, user, service_params).and_return(double(execute: true))
@@ -266,6 +266,22 @@ describe Projects::NotesController do
end
end
+ context 'when creating a comment on a commit with SHA1 starting with a large number' do
+ let(:commit) { create(:commit, project: project, id: '842616594688d2351480dfebd67b3d8d15571e6d') }
+
+ it 'creates a note successfully' do
+ expect do
+ post :create, params: {
+ note: { note: 'some note', commit_id: commit.id },
+ namespace_id: project.namespace,
+ project_id: project,
+ target_type: 'commit',
+ target_id: commit.id
+ }
+ end.to change { Note.count }.by(1)
+ end
+ end
+
context 'when creating a commit comment from an MR fork' do
let(:project) { create(:project, :repository) }