require 'sqlite3' require 'remote_db' module TestDb include RemoteDb::Concerns::Configurable def self.require_models load File.join([File.dirname(__FILE__), 'person.rb']) end def self.prepare_test_db! db_file = configuration.database db = SQLite3::Database.new db_file db.execute 'CREATE TABLE IF NOT EXISTS persons (id INTEGER PRIMARY KEY, first_name TEXT, last_name TEXT)' db.execute "INSERT INTO persons(id, first_name, last_name) VALUES (1, 'John', 'Smith')" end def self.cleanup_test_db! db_file = configuration.database if db_file && File.exists?(db_file) File.unlink(db_file) end end end