pre-req tasks set appropriate ENV["SOURCE"]
This commit is contained in:
Jon Ruskin 2018-03-28 22:21:50 -07:00
Родитель 933f9d7932
Коммит 7fad17c942
1 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -23,6 +23,30 @@ task :setup do
end
end
sources = Dir["lib/licensed/source/*.rb"].map { |f| File.basename(f, ".*") }
namespace :test do
sources.each do |source|
# hidden task to set ENV and filter tests to the given source
# see `each_source` in test/test_helper.rb
namespace source.to_sym do
task :env do
ENV["SOURCE"] = source
end
end
Rake::TestTask.new(source => "test:#{source}:env") do |t|
t.description = "Run #{source} tests"
t.libs << "test"
t.libs << "lib"
# use negative lookahead to exclude all source tests except
# the tests for `source`
t.test_files = FileList["test/**/*_test.rb"].exclude(/test\/source\/(!?#{source}).*?_test.rb/)
end
end
end
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"