• Bob Van Landuyt's avatar
    Enable adding feature categories to controllers · afd08055
    Bob Van Landuyt authored
    This allows us to specify a feature category on controller
    actions.
    
    To specify a feature category can be specified on an entire controller
    using:
    
      feature_category :source_code_management
    
    The feature category can be scoped to a list of actions using the
    `only` argument, actions can be excluded using the `except` argument.
    
      feature_category :source_code_management, only: [:create, :update]
      feature_category :source_code_management, except: [:metrics_reports]
    
    `except` and `only` arguments can not be combined. When specifying
    `unless` all other actions will get the category assigned.
    
    The assignment can also be scoped using `if` and `unless` procs:
    
      feature_category :source_code_management,
                       unless: -> (action) { action.include?("reports") }
                       if: -> (action) { action.include?("widget") }
    
    In this case, both procs need to be satisfied for the action to get
    the category assigned.
    
    The `spec/controllers/every_controller_spec.rb` will iterate over all
    defined routes, and check the controller to see if a category is
    assigned to all actions. The spec also validates if the used feature
    categories are known. And if the actions used in `only` and `except`
    configuration still exist as routes.
    afd08055
every_controller_spec.rb 3.34 KB