Commit f65b9cc5 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'use-gitlab-feature-categories-in-specs' into 'master'

Use Gitlab::FeatureCategories in specs

See merge request gitlab-org/gitlab!71951
parents db1242b5 934e0f60
......@@ -21,7 +21,7 @@ RSpec.describe Gitlab::EtagCaching::Router::Restful do
end
it 'has a valid feature category for every route', :aggregate_failures do
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).to_set
feature_categories = Gitlab::FeatureCategories.default.categories
described_class.ee_routes.each do |route|
expect(feature_categories).to include(route.feature_category), "#{route.name} has a category of #{route.feature_category}, which is not valid"
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe "Every controller" do
context "feature categories" do
let_it_be(:feature_categories) do
YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:to_sym).to_set
Gitlab::FeatureCategories.default.categories.map(&:to_sym).to_set
end
let_it_be(:controller_actions) do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Every API endpoint' do
context 'feature categories' do
let_it_be(:feature_categories) do
YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:to_sym).to_set
Gitlab::FeatureCategories.default.categories.map(&:to_sym).to_set
end
let_it_be(:api_endpoints) do
......
......@@ -11,7 +11,7 @@ RSpec.describe Gitlab::EtagCaching::Router::Graphql do
end
it 'has a valid feature category for every route', :aggregate_failures do
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).to_set
feature_categories = Gitlab::FeatureCategories.default.categories
described_class::ROUTES.each do |route|
expect(feature_categories).to include(route.feature_category), "#{route.name} has a category of #{route.feature_category}, which is not valid"
......
......@@ -107,7 +107,7 @@ RSpec.describe Gitlab::EtagCaching::Router::Restful do
end
it 'has a valid feature category for every route', :aggregate_failures do
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).to_set
feature_categories = Gitlab::FeatureCategories.default.categories
described_class::ROUTES.each do |route|
expect(feature_categories).to include(route.feature_category), "#{route.name} has a category of #{route.feature_category}, which is not valid"
......
......@@ -349,7 +349,7 @@ RSpec.describe Gitlab::Metrics::RequestsRackMiddleware, :aggregate_failures do
it 'has every label in config/feature_categories.yml' do
defaults = [::Gitlab::FeatureCategories::FEATURE_CATEGORY_DEFAULT, 'not_owned']
feature_categories = YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:strip) + defaults
feature_categories = Gitlab::FeatureCategories.default.categories + defaults
expect(described_class::FEATURE_CATEGORIES_TO_INITIALIZE).to all(be_in(feature_categories))
end
......
......@@ -48,7 +48,7 @@ RSpec.describe 'Every Sidekiq worker' do
describe "feature category declarations" do
let(:feature_categories) do
YAML.load_file(Rails.root.join('config', 'feature_categories.yml')).map(&:to_sym).to_set
Gitlab::FeatureCategories.default.categories.map(&:to_sym).to_set
end
# All Sidekiq worker classes should declare a valid `feature_category`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment