summaryrefslogtreecommitdiff
path: root/spec/requests/api/notes_spec.rb
diff options
context:
space:
mode:
authorMichael Greene <michael.greene@gmail.com>2016-04-05 13:04:11 -0500
committerMichael Greene <michael.greene@gmail.com>2016-04-13 12:04:09 -0500
commitc1467f5d97c04c22e2119ace084bb016f8f53d48 (patch)
treeb12c7210aa21f40917ae83dd635435e54e2c8519 /spec/requests/api/notes_spec.rb
parent28a7fe25fdf28042630282ace35e37310c8f0a12 (diff)
downloadgitlab-ce-c1467f5d97c04c22e2119ace084bb016f8f53d48.tar.gz
Allow back dating notes on creation
Diffstat (limited to 'spec/requests/api/notes_spec.rb')
-rw-r--r--spec/requests/api/notes_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb
index a467bc935af..ec9eda0a2ed 100644
--- a/spec/requests/api/notes_spec.rb
+++ b/spec/requests/api/notes_spec.rb
@@ -158,6 +158,19 @@ describe API::API, api: true do
post api("/projects/#{project.id}/issues/#{issue.id}/notes"), body: 'hi!'
expect(response.status).to eq(401)
end
+
+ context 'when an admin or owner makes the request' do
+ it 'accepts the creation date to be set' do
+ creation_time = 2.weeks.ago
+ post api("/projects/#{project.id}/issues/#{issue.id}/notes", user),
+ body: 'hi!', created_at: creation_time
+ expect(response.status).to eq(201)
+ expect(json_response['body']).to eq('hi!')
+ expect(json_response['author']['username']).to eq(user.username)
+ expect(Time.parse(json_response['created_at'])).to be_within(1.second).of(creation_time)
+ end
+ end
+
end
context "when noteable is a Snippet" do