-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Rakefile
42 lines (34 loc) · 1.3 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList["test/**/*_test.rb"]
t.warning = true
end
task default: :test
desc "Setup database used for testing on PostgreSQL"
task :db_setup_postgres do
sh 'psql -U postgres -c "CREATE USER sequel_activerecord_connection PASSWORD \'sequel_activerecord_connection\'"'
sh 'createdb -U postgres -O sequel_activerecord_connection sequel_activerecord_connection'
end
desc "Teardown database used for testing on PostgreSQL"
task :db_teardown_postgres do
sh 'dropdb -U postgres sequel_activerecord_connection'
sh 'dropuser -U postgres sequel_activerecord_connection'
end
desc "Setup database used for testing on MySQL"
task :db_setup_mysql do
sh 'mysql -u root -p mysql < test/sql/mysql_setup.sql'
end
desc "Teardown database used for testing on MySQL"
task :db_teardown_mysql do
sh 'mysql -u root -p mysql < test/sql/mysql_teardown.sql'
end
desc "Setup database used for testing on Microsoft SQL Server"
task :db_setup_mssql do
sh 'docker exec -it sqledge /opt/mssql/bin/sqlcmd -b -r1 -i /home/mssql/setup.sql'
end
desc "Teardown database used for testing on Microsoft SQL Server"
task :db_teardown_mssql do
sh 'docker exec -it sqledge /opt/mssql/bin/sqlcmd -b -r1 -i /home/mssql/teardown.sql'
end