summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-21 18:11:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-21 18:11:18 +0000
commit79f759cc144c7020942f09762154c6758ee1d275 (patch)
tree5d159ea257006957a34e854949662ad67a8c3532 /spec/controllers
parent9ef26edc4ae561ba072dee3900fef4408e227b48 (diff)
downloadgitlab-ce-79f759cc144c7020942f09762154c6758ee1d275.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/application_controller_spec.rb8
-rw-r--r--spec/controllers/every_controller_spec.rb11
-rw-r--r--spec/controllers/metrics_controller_spec.rb6
3 files changed, 15 insertions, 10 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 218aa04dd3f..93491246e2c 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -967,6 +967,14 @@ RSpec.describe ApplicationController do
end
end
+ describe '.endpoint_id_for_action' do
+ controller(described_class) { }
+
+ it 'returns an expected endpoint id' do
+ expect(controller.class.endpoint_id_for_action('hello')).to eq('AnonymousController#hello')
+ end
+ end
+
describe '#current_user' do
controller(described_class) do
def index; end
diff --git a/spec/controllers/every_controller_spec.rb b/spec/controllers/every_controller_spec.rb
index a1c377eff76..7d9d1d158b2 100644
--- a/spec/controllers/every_controller_spec.rb
+++ b/spec/controllers/every_controller_spec.rb
@@ -9,16 +9,7 @@ RSpec.describe "Every controller" do
end
let_it_be(:controller_actions) do
- # This will return tuples of all controller actions defined in the routes
- # Only for controllers inheriting ApplicationController
- # Excluding controllers from gems (OAuth, Sidekiq)
- Rails.application.routes.routes
- .map { |route| route.required_defaults.presence }
- .compact
- .select { |route| route[:controller].present? && route[:action].present? }
- .map { |route| [constantize_controller(route[:controller]), route[:action]] }
- .select { |(controller, action)| controller&.include?(::Gitlab::WithFeatureCategory) }
- .reject { |(controller, action)| controller == ApplicationController || controller == Devise::UnlocksController }
+ Gitlab::RequestEndpoints.all_controller_actions
end
let_it_be(:routes_without_category) do
diff --git a/spec/controllers/metrics_controller_spec.rb b/spec/controllers/metrics_controller_spec.rb
index 9fa90dde997..4f74af295c6 100644
--- a/spec/controllers/metrics_controller_spec.rb
+++ b/spec/controllers/metrics_controller_spec.rb
@@ -67,6 +67,12 @@ RSpec.describe MetricsController, :request_store do
expect(response.body).to match(/^prometheus_counter 1$/)
end
+ it 'initializes the rails request SLIs' do
+ expect(Gitlab::Metrics::RailsSlis).to receive(:initialize_request_slis_if_needed!).and_call_original
+
+ get :index
+ end
+
context 'prometheus metrics are disabled' do
before do
allow(Gitlab::Metrics).to receive(:prometheus_metrics_enabled?).and_return(false)