summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/etag_caching/middleware_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/etag_caching/middleware_spec.rb')
-rw-r--r--spec/lib/gitlab/etag_caching/middleware_spec.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/lib/gitlab/etag_caching/middleware_spec.rb b/spec/lib/gitlab/etag_caching/middleware_spec.rb
index 3122a3b1c07..c4da89e5f5c 100644
--- a/spec/lib/gitlab/etag_caching/middleware_spec.rb
+++ b/spec/lib/gitlab/etag_caching/middleware_spec.rb
@@ -33,7 +33,6 @@ RSpec.describe Gitlab::EtagCaching::Middleware, :clean_gitlab_redis_shared_state
expect(headers['ETag']).to be_nil
expect(headers['X-Gitlab-From-Cache']).to be_nil
- expect(headers[::Gitlab::Metrics::RequestsRackMiddleware::FEATURE_CATEGORY_HEADER]).to be_nil
end
it 'passes status code from app' do
@@ -41,6 +40,12 @@ RSpec.describe Gitlab::EtagCaching::Middleware, :clean_gitlab_redis_shared_state
expect(status).to eq app_status_code
end
+
+ it 'does not set feature category attribute' do
+ expect(Gitlab::ApplicationContext).not_to receive(:push)
+
+ _, _, _ = middleware.call(build_request(path, if_none_match))
+ end
end
context 'when there is no ETag in store for given resource' do
@@ -164,8 +169,15 @@ RSpec.describe Gitlab::EtagCaching::Middleware, :clean_gitlab_redis_shared_state
it 'sets correct headers' do
_, headers, _ = middleware.call(build_request(path, if_none_match))
- expect(headers).to include('X-Gitlab-From-Cache' => 'true',
- ::Gitlab::Metrics::RequestsRackMiddleware::FEATURE_CATEGORY_HEADER => 'issue_tracking')
+ expect(headers).to include('X-Gitlab-From-Cache' => 'true')
+ end
+
+ it "pushes route's feature category to the context" do
+ expect(Gitlab::ApplicationContext).to receive(:push).with(
+ feature_category: 'issue_tracking'
+ )
+
+ _, _, _ = middleware.call(build_request(path, if_none_match))
end
it_behaves_like 'sends a process_action.action_controller notification', 304