Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2017-08-28 18:13:22 +0300
committerRobert Schilling <rschilling@student.tugraz.at>2017-08-29 11:12:10 +0300
commitee4820a5268d02fb7ed142511d1a194f06629a1e (patch)
treedfca250f557830c030c21941bf8ab7ca8d5e829c /spec/support
parent8bd9fb4cc4f8689a23c68e1b7f893ee59907069f (diff)
Add a spec when ressource is not modified
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/requests/api/status_shared_examples.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/support/shared_examples/requests/api/status_shared_examples.rb b/spec/support/shared_examples/requests/api/status_shared_examples.rb
index 1bffd1e49db..7d7f66adeab 100644
--- a/spec/support/shared_examples/requests/api/status_shared_examples.rb
+++ b/spec/support/shared_examples/requests/api/status_shared_examples.rb
@@ -43,11 +43,25 @@ end
shared_examples_for '412 response' do
let(:params) { nil }
- before do
- delete request, params, { 'HTTP_IF_UNMODIFIED_SINCE' => '1990-01-12T00:00:48-0600' }
+ let(:success_status) { 204 }
+
+ context 'for a modified ressource' do
+ before do
+ delete request, params, { 'HTTP_IF_UNMODIFIED_SINCE' => '1990-01-12T00:00:48-0600' }
+ end
+
+ it 'returns 412' do
+ expect(response).to have_gitlab_http_status(412)
+ end
end
- it 'returns 412' do
- expect(response).to have_gitlab_http_status(412)
+ context 'for an unmodified ressource' do
+ before do
+ delete request, params, { 'HTTP_IF_UNMODIFIED_SINCE' => Time.now }
+ end
+
+ it 'returns accepted' do
+ expect(response).to have_gitlab_http_status(success_status)
+ end
end
end