2017-08-14 13:08:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-06 13:15:47 -04:00
|
|
|
gem "minitest"
|
|
|
|
require "minitest"
|
2017-10-21 09:08:33 -04:00
|
|
|
require "rails/test_unit/runner"
|
2010-06-09 17:14:47 -04:00
|
|
|
|
2012-10-14 06:03:39 -04:00
|
|
|
task default: :test
|
2011-10-07 16:25:03 -04:00
|
|
|
|
2017-03-04 08:54:03 -05:00
|
|
|
desc "Runs all tests in test folder except system ones"
|
2011-12-21 12:10:35 -05:00
|
|
|
task :test do
|
2015-02-18 10:17:31 -05:00
|
|
|
$: << "test"
|
2017-03-04 08:54:03 -05:00
|
|
|
|
|
|
|
if ENV.key?("TEST")
|
2017-06-25 13:08:26 -04:00
|
|
|
Rails::TestUnit::Runner.rake_run([ENV["TEST"]])
|
2016-08-07 17:41:00 -04:00
|
|
|
else
|
2017-06-25 13:08:26 -04:00
|
|
|
Rails::TestUnit::Runner.rake_run
|
2016-08-07 17:41:00 -04:00
|
|
|
end
|
2011-12-21 12:10:35 -05:00
|
|
|
end
|
2005-09-03 11:13:06 -04:00
|
|
|
|
2006-02-26 23:38:39 -05:00
|
|
|
namespace :test do
|
2010-04-08 23:40:48 -04:00
|
|
|
task :prepare do
|
2014-11-28 05:03:52 -05:00
|
|
|
# Placeholder task for other Railtie and plugins to enhance.
|
|
|
|
# If used with Active Record, this task runs before the database schema is synchronized.
|
2010-04-08 23:40:48 -04:00
|
|
|
end
|
|
|
|
|
2016-08-06 13:38:55 -04:00
|
|
|
task run: %w[test]
|
2014-10-21 15:13:09 -04:00
|
|
|
|
|
|
|
desc "Run tests quickly, but also reset db"
|
2016-08-06 13:38:55 -04:00
|
|
|
task db: %w[db:test:prepare test]
|
2011-12-21 12:10:35 -05:00
|
|
|
|
2019-01-16 10:28:13 -05:00
|
|
|
["models", "helpers", "channels", "controllers", "mailers", "integration", "jobs", "mailboxes"].each do |name|
|
2015-02-18 10:17:31 -05:00
|
|
|
task name => "test:prepare" do
|
|
|
|
$: << "test"
|
2017-06-25 13:08:26 -04:00
|
|
|
Rails::TestUnit::Runner.rake_run(["test/#{name}"])
|
2013-05-02 11:16:20 -04:00
|
|
|
end
|
2013-03-29 18:31:31 -04:00
|
|
|
end
|
|
|
|
|
2020-05-10 20:22:49 -04:00
|
|
|
desc "Runs all tests, including system tests"
|
|
|
|
task all: "test:prepare" do
|
|
|
|
$: << "test"
|
|
|
|
Rails::TestUnit::Runner.rake_run(["test/**/*_test.rb"])
|
|
|
|
end
|
|
|
|
|
2016-08-06 13:38:55 -04:00
|
|
|
task generators: "test:prepare" do
|
2015-02-18 10:17:31 -05:00
|
|
|
$: << "test"
|
2017-06-25 13:08:26 -04:00
|
|
|
Rails::TestUnit::Runner.rake_run(["test/lib/generators"])
|
2013-07-13 06:49:31 -04:00
|
|
|
end
|
|
|
|
|
2016-08-06 13:38:55 -04:00
|
|
|
task units: "test:prepare" do
|
2015-02-18 10:17:31 -05:00
|
|
|
$: << "test"
|
2017-06-25 13:08:26 -04:00
|
|
|
Rails::TestUnit::Runner.rake_run(["test/models", "test/helpers", "test/unit"])
|
2013-03-29 18:31:31 -04:00
|
|
|
end
|
|
|
|
|
2016-08-06 13:38:55 -04:00
|
|
|
task functionals: "test:prepare" do
|
2015-02-18 10:17:31 -05:00
|
|
|
$: << "test"
|
2017-06-25 13:08:26 -04:00
|
|
|
Rails::TestUnit::Runner.rake_run(["test/controllers", "test/mailers", "test/functional"])
|
2013-03-29 18:31:31 -04:00
|
|
|
end
|
2016-08-05 09:36:54 -04:00
|
|
|
|
2017-04-28 11:38:29 -04:00
|
|
|
desc "Run system tests only"
|
2016-08-05 09:36:54 -04:00
|
|
|
task system: "test:prepare" do
|
|
|
|
$: << "test"
|
2017-06-25 13:08:26 -04:00
|
|
|
Rails::TestUnit::Runner.rake_run(["test/system"])
|
2016-08-05 09:36:54 -04:00
|
|
|
end
|
2006-03-18 01:47:46 -05:00
|
|
|
end
|