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:
authorDouwe Maan <douwe@selenight.nl>2017-08-31 10:13:41 +0300
committerDouwe Maan <douwe@selenight.nl>2017-08-31 10:13:41 +0300
commit7c215dd23dfa942d6b83252403ce326df96ab3ea (patch)
tree52c2d7bfa1a11beac6bb135c6eb425dd22d2e320 /spec/support
parenta540f55c6e8ff64f7284ec4194f4c16ca711c685 (diff)
parentd6e956d3a89fbb7f1a503f152fe9a4e2ca931d85 (diff)
Merge branch 'master' into issue-discussions-refactor
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/requests/api/status_shared_examples.rb25
1 files changed, 25 insertions, 0 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 226277411d6..7d7f66adeab 100644
--- a/spec/support/shared_examples/requests/api/status_shared_examples.rb
+++ b/spec/support/shared_examples/requests/api/status_shared_examples.rb
@@ -40,3 +40,28 @@ shared_examples_for '404 response' do
end
end
end
+
+shared_examples_for '412 response' do
+ let(:params) { nil }
+ 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
+
+ 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