diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/lib/gitlab/middleware/path_traversal_check_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/lib/gitlab/middleware/path_traversal_check_spec.rb')
-rw-r--r-- | spec/lib/gitlab/middleware/path_traversal_check_spec.rb | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/spec/lib/gitlab/middleware/path_traversal_check_spec.rb b/spec/lib/gitlab/middleware/path_traversal_check_spec.rb index 91081cc88ea..a0d7711c881 100644 --- a/spec/lib/gitlab/middleware/path_traversal_check_spec.rb +++ b/spec/lib/gitlab/middleware/path_traversal_check_spec.rb @@ -5,7 +5,8 @@ require 'spec_helper' RSpec.describe ::Gitlab::Middleware::PathTraversalCheck, feature_category: :shared do using RSpec::Parameterized::TableSyntax - let(:fake_response) { [200, { 'Content-Type' => 'text/plain' }, ['OK']] } + let(:fake_response_status) { 200 } + let(:fake_response) { [fake_response_status, { 'Content-Type' => 'text/plain' }, ['OK']] } let(:fake_app) { ->(_) { fake_response } } let(:middleware) { described_class.new(fake_app) } @@ -31,8 +32,11 @@ RSpec.describe ::Gitlab::Middleware::PathTraversalCheck, feature_category: :shar .and_call_original expect(::Gitlab::AppLogger) .to receive(:warn) - .with({ class_name: described_class.name, duration_ms: instance_of(Float) }) - .and_call_original + .with({ + class_name: described_class.name, + duration_ms: instance_of(Float), + status: fake_response_status + }).and_call_original expect(subject).to eq(fake_response) end @@ -61,8 +65,11 @@ RSpec.describe ::Gitlab::Middleware::PathTraversalCheck, feature_category: :shar .not_to receive(:check_path_traversal!) expect(::Gitlab::AppLogger) .to receive(:warn) - .with({ class_name: described_class.name, duration_ms: instance_of(Float) }) - .and_call_original + .with({ + class_name: described_class.name, + duration_ms: instance_of(Float), + status: fake_response_status + }).and_call_original expect(subject).to eq(fake_response) end @@ -99,7 +106,8 @@ RSpec.describe ::Gitlab::Middleware::PathTraversalCheck, feature_category: :shar duration_ms: instance_of(Float), message: described_class::PATH_TRAVERSAL_MESSAGE, fullpath: fullpath, - method: method.upcase + method: method.upcase, + status: fake_response_status }).and_call_original expect(subject).to eq(fake_response) @@ -124,7 +132,8 @@ RSpec.describe ::Gitlab::Middleware::PathTraversalCheck, feature_category: :shar class_name: described_class.name, message: described_class::PATH_TRAVERSAL_MESSAGE, fullpath: fullpath, - method: method.upcase + method: method.upcase, + status: fake_response_status }).and_call_original expect(subject).to eq(fake_response) |