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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-11 12:11:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-11 12:11:50 +0300
commit34facbbce9531f6c9a0ca8e4eaa112e4cd3d7e06 (patch)
tree6f8f321fff3d97cab9776521e04e1976985237e0 /spec/requests
parent20d8491f30854d1193e9ae0fc8fa97051354551d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/projects/merge_requests/diffs_spec.rb44
1 files changed, 39 insertions, 5 deletions
diff --git a/spec/requests/projects/merge_requests/diffs_spec.rb b/spec/requests/projects/merge_requests/diffs_spec.rb
index 4e6a7be415e..937b0f1d713 100644
--- a/spec/requests/projects/merge_requests/diffs_spec.rb
+++ b/spec/requests/projects/merge_requests/diffs_spec.rb
@@ -252,14 +252,48 @@ RSpec.describe 'Merge Requests Diffs' do
end
context 'when the paths is given' do
- subject { go(page: 0, per_page: 5, paths: %w[README CHANGELOG]) }
+ subject { go(headers: headers, page: 0, per_page: 5, paths: %w[README CHANGELOG]) }
- it 'does not use cache' do
- expect(Rails.cache).not_to receive(:fetch).with(/cache:gitlab:PaginatedDiffSerializer/).and_call_original
+ before do
+ go(page: 0, per_page: 5, paths: %w[README CHANGELOG])
+ end
- subject
+ context 'when using ETag caching' do
+ let(:headers) { { 'If-None-Match' => response.etag } }
+
+ context 'when etag_merge_request_diff_batches is true' do
+ it 'does not serialize diffs' do
+ expect(PaginatedDiffSerializer).not_to receive(:new)
- expect(response).to have_gitlab_http_status(:success)
+ subject
+
+ expect(response).to have_gitlab_http_status(:not_modified)
+ end
+ end
+
+ context 'when etag_merge_request_diff_batches is false' do
+ before do
+ stub_feature_flags(etag_merge_request_diff_batches: false)
+ end
+
+ it 'does not use cache' do
+ expect(Rails.cache).not_to receive(:fetch).with(/cache:gitlab:PaginatedDiffSerializer/).and_call_original
+
+ subject
+
+ expect(response).to have_gitlab_http_status(:success)
+ end
+ end
+ end
+
+ context 'when not using ETag caching' do
+ it 'does not use cache' do
+ expect(Rails.cache).not_to receive(:fetch).with(/cache:gitlab:PaginatedDiffSerializer/).and_call_original
+
+ subject
+
+ expect(response).to have_gitlab_http_status(:success)
+ end
end
end
end