[Git][noosfero/noosfero][master] stoa: temp file for db ins't working well

Bráulio Bhavamitra gitlab at mg.gitlab.com
Wed Mar 15 16:16:46 BRT 2017


Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero


Commits:
0afb95d1 by Braulio Bhavamitra at 2017-03-15T16:14:59-03:00
stoa: temp file for db ins't working well

- - - - -


1 changed file:

- plugins/stoa/test/setup_db.rb


Changes:

=====================================
plugins/stoa/test/setup_db.rb
=====================================
--- a/plugins/stoa/test/setup_db.rb
+++ b/plugins/stoa/test/setup_db.rb
@@ -1,14 +1,20 @@
+db_path = 'plugins/stoa/test/test.db'
 ActiveRecord::Base.configurations['stoa'] = {
   adapter:  'sqlite3',
-  database: Tempfile.new('stoa-test').path,
+  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
+end unless 'pessoa'.in? ActiveRecord::Base.connection.tables
+
 ActiveRecord::Base.establish_connection :test
 
+at_exit do
+  File.unlink db_path
+end



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/0afb95d14273302c9f4beff7971d01011afe9734
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170315/192a073f/attachment.html>


More information about the Noosfero-dev mailing list