summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorMichael Greene <michael.greene@gmail.com>2016-04-05 12:05:55 -0500
committerMichael Greene <michael.greene@gmail.com>2016-04-13 12:04:09 -0500
commit28a7fe25fdf28042630282ace35e37310c8f0a12 (patch)
treecb8c857fdb640ff69af3c04c2a1122b3d4e986bc /spec/requests
parente17f79fdfa40fb7cef02bdbc3f0f72a67da12893 (diff)
downloadgitlab-ce-28a7fe25fdf28042630282ace35e37310c8f0a12.tar.gz
Allow back dating issues on update
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/issues_spec.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index 86ea223f206..f88e39cad9e 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -321,13 +321,13 @@ describe API::API, api: true do
end
context 'when an admin or owner makes the request' do
- it "accepts the creation date to be set" do
+ it 'accepts the creation date to be set' do
+ creation_time = 2.weeks.ago
post api("/projects/#{project.id}/issues", user),
- title: 'new issue', labels: 'label, label2', created_at: 2.weeks.ago
+ title: 'new issue', labels: 'label, label2', created_at: creation_time
expect(response.status).to eq(201)
- # this take about a second, so probably not equal
- expect(Time.parse(json_response['created_at'])).to be <= 2.weeks.ago
+ expect(Time.parse(json_response['created_at'])).to be_within(1.second).of(creation_time)
end
end
end
@@ -478,6 +478,18 @@ describe API::API, api: true do
expect(json_response['labels']).to include 'label2'
expect(json_response['state']).to eq "closed"
end
+
+ context 'when an admin or owner makes the request' do
+ it 'accepts the update date to be set' do
+ update_time = 2.weeks.ago
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: 'label3', state_event: 'close', updated_at: update_time
+ expect(response.status).to eq(200)
+
+ expect(json_response['labels']).to include 'label3'
+ expect(Time.parse(json_response['updated_at'])).to be_within(1.second).of(update_time)
+ end
+ end
end
describe "DELETE /projects/:id/issues/:issue_id" do