You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
606 B
28 lines
606 B
2 years ago
|
require "minitest/test_task"
|
||
|
require "sequel"
|
||
|
|
||
|
task default: :test
|
||
|
|
||
|
namespace :db do
|
||
|
desc "Run migrations"
|
||
|
task :migrate, [:version] do |t, args|
|
||
|
require "sequel/core"
|
||
|
Sequel.extension :migration
|
||
|
version = args[:version].to_i if args[:version]
|
||
|
Sequel.connect(ENV.fetch("DATABASE_URL")) do |db|
|
||
|
Sequel::Migrator.run(db, "db/migrations", target: version)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
Minitest::TestTask.create(:test) do |t|
|
||
|
t.test_globs = ["test/**/test_*.rb"]
|
||
|
end
|
||
|
|
||
|
namespace :test do
|
||
|
desc "Run tests on Ruby file changes"
|
||
|
task :watch do
|
||
|
sh "fd .*.rb | entr -d rake test"
|
||
|
end
|
||
|
end
|