cirandas.net

ref: master

plugins/stoa/test/setup_db.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
db_path = 'plugins/stoa/test/test.db'
ActiveRecord::Base.configurations['stoa'] = {
  adapter:  'sqlite3',
  database: db_path,
}

ActiveRecord::Base.establish_connection :stoa

ActiveRecord::Schema.verbose = false
ActiveRecord::Schema.create_table 'pessoa' do |t|
  t.integer  'codpes'
  t.text     'numcpf'
  t.date     'dtanas'
end unless 'pessoa'.in? ActiveRecord::Base.connection.tables

ActiveRecord::Base.establish_connection :test

at_exit do
  File.unlink db_path
end