summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/notes_controller_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-08-30 10:43:10 +0200
committerDouwe Maan <douwe@selenight.nl>2017-08-30 10:43:10 +0200
commita540f55c6e8ff64f7284ec4194f4c16ca711c685 (patch)
tree6f05a175db0b905b9d915d2831f08b2e68ca1369 /spec/controllers/projects/notes_controller_spec.rb
parentb181d3124e4aefca59fb8fe64400eab8d9c73ad8 (diff)
downloadgitlab-ce-a540f55c6e8ff64f7284ec4194f4c16ca711c685.tar.gz
Fix specs
Diffstat (limited to 'spec/controllers/projects/notes_controller_spec.rb')
-rw-r--r--spec/controllers/projects/notes_controller_spec.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb
index f280c55059c..6ffe41b8608 100644
--- a/spec/controllers/projects/notes_controller_spec.rb
+++ b/spec/controllers/projects/notes_controller_spec.rb
@@ -46,10 +46,13 @@ describe Projects::NotesController do
end
context 'for a discussion note' do
- let!(:note) { create(:discussion_note_on_issue, noteable: issue, project: project) }
+ let(:project) { create(:project, :repository) }
+ let!(:note) { create(:discussion_note_on_merge_request, project: project) }
+
+ let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id) }
it 'responds with the expected attributes' do
- get :index, request_params
+ get :index, params
expect(note_json[:id]).to eq(note.id)
expect(note_json[:discussion_html]).not_to be_nil
@@ -104,10 +107,12 @@ describe Projects::NotesController do
end
context 'for a regular note' do
- let!(:note) { create(:note, noteable: issue, project: project) }
+ let!(:note) { create(:note_on_merge_request, project: project) }
+
+ let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id) }
it 'responds with the expected attributes' do
- get :index, request_params
+ get :index, params
expect(note_json[:id]).to eq(note.id)
expect(note_json[:html]).not_to be_nil
@@ -125,7 +130,9 @@ describe Projects::NotesController do
note: { note: 'some note', noteable_id: merge_request.id, noteable_type: 'MergeRequest' },
namespace_id: project.namespace,
project_id: project,
- merge_request_diff_head_sha: 'sha'
+ merge_request_diff_head_sha: 'sha',
+ target_type: 'merge_request',
+ target_id: merge_request.id
}
end