class Judges::Categories

License
MIT
Copyright
Copyright © 2024-2025 Yegor Bugayenko
Author

Yegor Bugayenko (yegor256@gmail.com)
tests should be executed based on their associated categories.
specific categories of tests. It provides a mechanism to filter which
This class manages test categories, allowing you to enable or disable
Categories of tests.

def initialize(enable, disable)

Parameters:
  • disable (Array) -- List of categories to disable
  • enable (Array) -- List of categories to enable
def initialize(enable, disable)
  @enable = enable.is_a?(Array) ? enable : []
  @disable = disable.is_a?(Array) ? disable : []
end

def ok?(cats)

Other tags:
    Example: Check if a test with categories should run -

Returns:
  • (Boolean) - true if the test should be executed, false otherwise

Parameters:
  • cats (Array, String, nil) -- List of categories associated with the test,
def ok?(cats)
  cats = [] if cats.nil?
  cats = [cats] unless cats.is_a?(Array)
  cats.each do |c|
    return false if @disable.any?(c)
    return true if @enable.any?(c)
  end
  return true if @enable.empty?
  false
end