Welcome to mirror list, hosted at ThFree Co, Russian Federation.

request_endpoints_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0c939bfb0ee5dac450ae39fc9ba49a72ecc1a8c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true
require 'spec_helper'

RSpec.describe Gitlab::RequestEndpoints do
  describe '.all_api_endpoints' do
    it 'selects all feature API classes' do
      api_classes = described_class.all_api_endpoints.map { |route| route.app.options[:for] }

      expect(api_classes).to all(include(Gitlab::EndpointAttributes))
    end
  end

  describe '.all_controller_actions' do
    it 'selects all feature controllers and action names' do
      all_controller_actions = described_class.all_controller_actions
      controller_classes = all_controller_actions.map(&:first)
      all_actions = all_controller_actions.map(&:last)

      expect(controller_classes).to all(include(Gitlab::EndpointAttributes))
      expect(controller_classes).not_to include(ApplicationController, Devise::UnlocksController)
      expect(all_actions).to all(be_a(String))
    end
  end
end