summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-03-30 21:06:09 -0600
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-05 17:44:14 +0100
commit21e10888c3fc0fe545c0443cf0e23f593df847a4 (patch)
treec6c89c2ea2c75ffae4529ab4dceb937ce2f6299a /spec
parentfe26b8af94e8e12a66249e28e34196a4f8b987c4 (diff)
downloadgitlab-ce-21e10888c3fc0fe545c0443cf0e23f593df847a4.tar.gz
Address review comments
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/notes_controller_spec.rb68
1 files changed, 7 insertions, 61 deletions
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb
index b276f9321c7..52a76776239 100644
--- a/spec/controllers/projects/notes_controller_spec.rb
+++ b/spec/controllers/projects/notes_controller_spec.rb
@@ -15,7 +15,6 @@ describe Projects::NotesController do
end
describe 'GET index' do
- let(:last_fetched_at) { '1487756246' }
let(:request_params) do
{
namespace_id: project.namespace,
@@ -35,6 +34,8 @@ describe Projects::NotesController do
end
it 'passes last_fetched_at from headers to NotesFinder' do
+ last_fetched_at = 3.hours.ago.to_i
+
request.headers['X-Last-Fetched-At'] = last_fetched_at
expect(NotesFinder).to receive(:new)
@@ -47,21 +48,11 @@ describe Projects::NotesController do
context 'for a discussion note' do
let!(:note) { create(:discussion_note_on_issue, noteable: issue, project: project) }
- it 'includes the ID' do
+ it 'responds with the expected attributes' do
get :index, request_params
expect(note_json[:id]).to eq(note.id)
- end
-
- it 'includes discussion_html' do
- get :index, request_params
-
expect(note_json[:discussion_html]).not_to be_nil
- end
-
- it "doesn't include diff_discussion_html" do
- get :index, request_params
-
expect(note_json[:diff_discussion_html]).to be_nil
end
end
@@ -72,21 +63,11 @@ describe Projects::NotesController do
let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id) }
- it 'includes the ID' do
+ it 'responds with the expected attributes' do
get :index, params
expect(note_json[:id]).to eq(note.id)
- end
-
- it 'includes discussion_html' do
- get :index, params
-
expect(note_json[:discussion_html]).not_to be_nil
- end
-
- it 'includes diff_discussion_html' do
- get :index, params
-
expect(note_json[:diff_discussion_html]).not_to be_nil
end
end
@@ -100,21 +81,11 @@ describe Projects::NotesController do
let(:params) { request_params.merge(target_type: 'merge_request', target_id: merge_request.id) }
- it 'includes the ID' do
+ it 'responds with the expected attributes' do
get :index, params
expect(note_json[:id]).to eq(note.id)
- end
-
- it 'includes discussion_html' do
- get :index, params
-
expect(note_json[:discussion_html]).not_to be_nil
- end
-
- it "doesn't include diff_discussion_html" do
- get :index, params
-
expect(note_json[:diff_discussion_html]).to be_nil
end
end
@@ -122,21 +93,11 @@ describe Projects::NotesController do
context 'when displayed on the commit' do
let(:params) { request_params.merge(target_type: 'commit', target_id: note.commit_id) }
- it 'includes the ID' do
+ it 'responds with the expected attributes' do
get :index, params
expect(note_json[:id]).to eq(note.id)
- end
-
- it "doesn't include discussion_html" do
- get :index, params
-
expect(note_json[:discussion_html]).to be_nil
- end
-
- it "doesn't include diff_discussion_html" do
- get :index, params
-
expect(note_json[:diff_discussion_html]).to be_nil
end
end
@@ -145,27 +106,12 @@ describe Projects::NotesController do
context 'for a regular note' do
let!(:note) { create(:note, noteable: issue, project: project) }
- it 'includes the ID' do
+ it 'responds with the expected attributes' do
get :index, request_params
expect(note_json[:id]).to eq(note.id)
- end
-
- it 'includes html' do
- get :index, request_params
-
expect(note_json[:html]).not_to be_nil
- end
-
- it "doesn't include discussion_html" do
- get :index, request_params
-
expect(note_json[:discussion_html]).to be_nil
- end
-
- it "doesn't include diff_discussion_html" do
- get :index, request_params
-
expect(note_json[:diff_discussion_html]).to be_nil
end
end