diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /spec/controllers/every_controller_spec.rb | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'spec/controllers/every_controller_spec.rb')
-rw-r--r-- | spec/controllers/every_controller_spec.rb | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/spec/controllers/every_controller_spec.rb b/spec/controllers/every_controller_spec.rb index 4785ee9ed8f..d333c98ccf7 100644 --- a/spec/controllers/every_controller_spec.rb +++ b/spec/controllers/every_controller_spec.rb @@ -17,20 +17,27 @@ RSpec.describe "Every controller" do .compact .select { |route| route[:controller].present? && route[:action].present? } .map { |route| [constantize_controller(route[:controller]), route[:action]] } - .reject { |route| route.first.nil? || !route.first.include?(ControllerWithFeatureCategory) } + .select { |(controller, action)| controller&.include?(ControllerWithFeatureCategory) } + .reject { |(controller, action)| controller == Devise::UnlocksController } end let_it_be(:routes_without_category) do controller_actions.map do |controller, action| - "#{controller}##{action}" unless controller.feature_category_for_action(action) + next if controller.feature_category_for_action(action) + next unless controller.to_s.start_with?('B', 'C', 'D', 'E', 'F', 'Projects::MergeRequestsController') + + "#{controller}##{action}" end.compact end it "has feature categories" do - pending("We'll work on defining categories for all controllers: "\ - "https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/463") + routes_without_category.map { |x| x.split('#') }.group_by(&:first).each do |controller, actions| + puts controller + puts actions.map { |x| ":#{x.last}" }.sort.join(', ') + puts '' + end - expect(routes_without_category).to be_empty, "#{routes_without_category.first(10)} did not have a category" + expect(routes_without_category).to be_empty, "#{routes_without_category} did not have a category" end it "completed controllers don't get new routes without categories" do @@ -74,9 +81,9 @@ RSpec.describe "Every controller" do end def actions_defined_in_feature_category_config(controller) - feature_category_configs = controller.send(:class_attributes)[:feature_category_config] - feature_category_configs.map do |config| - Array(config.send(:only)) + Array(config.send(:except)) - end.flatten.uniq.map(&:to_s) + controller.send(:class_attributes)[:feature_category_config] + .values + .flatten + .map(&:to_s) end end |