debian-mirror-gitlab/spec/lib/gitlab/middleware/sidekiq_web_static_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
937 B
Ruby
Raw Normal View History

2021-11-11 11:23:49 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Middleware::SidekiqWebStatic do
let(:app) { double(:app) }
let(:middleware) { described_class.new(app) }
let(:env) { {} }
describe '#call' do
before do
env['HTTP_X_SENDFILE_TYPE'] = 'X-Sendfile'
env['PATH_INFO'] = path
end
context 'with an /admin/sidekiq route' do
let(:path) { '/admin/sidekiq/javascripts/application.js'}
it 'deletes the HTTP_X_SENDFILE_TYPE header' do
expect(app).to receive(:call)
middleware.call(env)
expect(env['HTTP_X_SENDFILE_TYPE']).to be_nil
end
end
context 'with some static asset route' do
let(:path) { '/assets/test.png' }
it 'keeps the HTTP_X_SENDFILE_TYPE header' do
expect(app).to receive(:call)
middleware.call(env)
expect(env['HTTP_X_SENDFILE_TYPE']).to eq('X-Sendfile')
end
end
end
end