diff options
author | Michael Greene <michael.greene@gmail.com> | 2016-04-05 21:04:11 +0300 |
---|---|---|
committer | Michael Greene <michael.greene@gmail.com> | 2016-04-13 20:04:09 +0300 |
commit | c1467f5d97c04c22e2119ace084bb016f8f53d48 (patch) | |
tree | b12c7210aa21f40917ae83dd635435e54e2c8519 /spec/requests/api/notes_spec.rb | |
parent | 28a7fe25fdf28042630282ace35e37310c8f0a12 (diff) |
Allow back dating notes on creation
Diffstat (limited to 'spec/requests/api/notes_spec.rb')
-rw-r--r-- | spec/requests/api/notes_spec.rb | 13 |
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 |