Module: Anyt::Tests
- Defined in:
- lib/anyt/tests.rb
Overview
Loads and runs test cases
Constant Summary collapse
- DEFAULT_PATTERNS =
[ File.("tests/**/*.rb", __dir__) ].freeze
Class Method Summary collapse
-
.load_all_tests ⇒ Object
Load all test files.
-
.load_tests ⇒ Object
Load tests code (filtered if present).
-
.run ⇒ Object
Run all loaded tests.
Class Method Details
.load_all_tests ⇒ Object
Load all test files
47 48 49 50 51 |
# 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 ⇒ Object
Load tests code (filtered if present)
NOTE: We should run this before launching RPC server
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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 |