Files
gitlab-foss/spec/lib/gitlab/middleware/action_controller_static_context_spec.rb
2024-09-03 15:10:58 +00:00

24 lines
785 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Middleware::ActionControllerStaticContext, feature_category: :error_budgets do
# to check the end to end tests, go to spec/requests/application_controller_spec.rb
let(:env) do
# env mimicking a controller action parsed by the rails routes
{ 'action_dispatch.request.path_parameters' => { controller: "dashboard/groups", action: "index" } }
end
let(:app) { ->(_env) { [200, {}, ["Hello World"]] } }
it 'populates context with static controller attributes' do
described_class.new(app).call(env)
expect(Labkit::Context.current.to_h).to include({
'meta.feature_category' => 'groups_and_projects',
'meta.caller_id' => 'Dashboard::GroupsController#index'
})
end
end