class Attestify::TestList
Holds the tests that will be loaded for a test run.
Attributes
dir[R]
Public Class Methods
new(files = nil, dir: nil)
click to toggle source
# File lib/attestify/test_list.rb, line 6 def initialize(files = nil, dir: nil) @dir = dir || "./test" @provided_files = files end
Public Instance Methods
run?(test_class, method)
click to toggle source
# File lib/attestify/test_list.rb, line 20 def run?(test_class, method) test_filters.any? { |filter| filter.run?(test_class, method) } end
test_files()
click to toggle source
# File lib/attestify/test_list.rb, line 16 def test_files @test_files ||= test_filters.map(&:file) end
test_helper_file()
click to toggle source
# File lib/attestify/test_list.rb, line 11 def test_helper_file @test_helper_file_path ||= File.join(dir, "test_helper.rb") @test_helper_file_path if File.file?(@test_helper_file_path) end
Private Instance Methods
all_file_filters_for(path)
click to toggle source
# File lib/attestify/test_list.rb, line 41 def all_file_filters_for(path) if File.directory?(path) Dir[File.join(path, "**/*_test.rb")].map { |file| Attestify::TestList::FileFilter.new(file) } elsif File.file?(path) Attestify::TestList::FileFilter.new(path) elsif path =~ /:\d+\z/ Attestify::TestList::FileFilter.with_line(path) end end
provided_files?()
click to toggle source
# File lib/attestify/test_list.rb, line 37 def provided_files? @provided_files && !@provided_files.empty? end
test_filters()
click to toggle source
# File lib/attestify/test_list.rb, line 26 def test_filters @test_filters ||= begin if provided_files? @provided_files.map { |path| all_file_filters_for(path) }.flatten.compact else all_file_filters_for(dir) || [] end end end