зеркало из https://github.com/github/licensed.git
add rake test tasks
pre-req tasks set appropriate ENV["SOURCE"]
This commit is contained in:
Родитель
933f9d7932
Коммит
7fad17c942
24
Rakefile
24
Rakefile
|
@ -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"
|
||||
|
|
Загрузка…
Ссылка в новой задаче