module Anyt::Tests

Loads and runs test cases

Constants

DEFAULT_PATTERNS

Public Class Methods

load_all_tests() click to toggle source

Load all test files

# File lib/anyt/tests.rb, line 47
def load_all_tests
  test_files_patterns.each do |pattern|
    Dir.glob(pattern).sort.each { |file| require file }
  end
end
load_tests() click to toggle source

Load tests code (filtered if present)

NOTE: We should run this before launching RPC server

# File lib/anyt/tests.rb, line 27
def load_tests
  return load_all_tests unless Anyt.config.filter_tests?

  skipped = []
  filter = Anyt.config.tests_filter

  test_files_patterns.each do |pattern|
    Dir.glob(pattern).sort.each do |file|
      if filter.call(file)
        require file
      else
        skipped << file.gsub(File.join(__dir__, "tests/"), "").gsub("_test.rb", "")
      end
    end
  end

  $stdout.print "Skipping tests: #{skipped.join(", ")}\n"
end
run() click to toggle source

Run all loaded tests

# File lib/anyt/tests.rb, line 16
def run
  Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new

  AnyCable.logger.debug "Run tests against: #{Anyt.config.target_url}"
  Minitest.run
end

Private Class Methods

test_files_patterns() click to toggle source
# File lib/anyt/tests.rb, line 55
def test_files_patterns
  @test_files_patterns ||= DEFAULT_PATTERNS.dup.tap do |patterns|
    patterns << Anyt.config.tests_path if Anyt.config.tests_path
  end
end