2017-08-14 13:08:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-06 13:28:46 -04:00
|
|
|
require "rake/testtask"
|
2004-11-23 20:04:44 -05:00
|
|
|
|
2016-08-06 13:38:55 -04:00
|
|
|
task default: :test
|
2013-01-01 05:03:40 -05:00
|
|
|
|
2016-01-31 13:01:03 -05:00
|
|
|
task :package
|
|
|
|
|
2013-01-01 05:03:40 -05:00
|
|
|
desc "Run all unit tests"
|
2016-08-06 13:38:55 -04:00
|
|
|
task test: "test:isolated"
|
2007-09-25 21:24:07 -04:00
|
|
|
|
2009-11-10 19:50:15 -05:00
|
|
|
namespace :test do
|
|
|
|
task :isolated do
|
2013-04-08 06:16:33 -04:00
|
|
|
dirs = (ENV["TEST_DIR"] || ENV["TEST_DIRS"] || "**").split(",")
|
|
|
|
test_files = dirs.map { |dir| "test/#{dir}/*_test.rb" }
|
|
|
|
Dir[*test_files].each do |file|
|
2009-11-10 19:50:15 -05:00
|
|
|
next true if file.include?("fixtures")
|
2015-12-02 15:30:44 -05:00
|
|
|
dash_i = [
|
2016-08-06 13:28:46 -04:00
|
|
|
"test",
|
|
|
|
"lib",
|
2017-05-15 10:17:28 -04:00
|
|
|
"#{__dir__}/../activesupport/lib",
|
|
|
|
"#{__dir__}/../actionpack/lib",
|
|
|
|
"#{__dir__}/../actionview/lib",
|
|
|
|
"#{__dir__}/../activemodel/lib"
|
2015-12-02 15:30:44 -05:00
|
|
|
]
|
|
|
|
ruby "-w", "-I#{dash_i.join ':'}", file
|
2010-06-24 04:56:16 -04:00
|
|
|
end
|
2009-11-10 19:50:15 -05:00
|
|
|
end
|
2006-11-01 22:34:03 -05:00
|
|
|
end
|
|
|
|
|
2016-08-06 13:28:46 -04:00
|
|
|
Rake::TestTask.new("test:regular") do |t|
|
2017-05-15 10:17:28 -04:00
|
|
|
t.libs << "test" << "#{__dir__}/../activesupport/lib"
|
2016-08-06 13:28:46 -04:00
|
|
|
t.pattern = "test/**/*_test.rb"
|
2015-08-27 22:48:46 -04:00
|
|
|
t.warning = false
|
2006-08-29 05:15:28 -04:00
|
|
|
t.verbose = true
|
2014-09-27 10:37:44 -04:00
|
|
|
t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
|
2006-08-29 05:15:28 -04:00
|
|
|
end
|