Sha256: 3c6c9d1d90d4c9b8a433ee01e95b73229f386ead0e3910d7f04fd09d7c02928d

Contents?: true

Size: 741 Bytes

Versions: 6

Compression:

Stored size: 741 Bytes

Contents

puts "Using native SQLite3"
require "active_record"
require 'logger'

ActiveRecord::Base.logger = Logger.new("debug.log")

db_file = "spec/fixtures/fixture_database.sqlite3"

ActiveRecord::Base.configurations = {
  "unit" => {
    :adapter  => 'sqlite3',
    :database => db_file,
    :timeout  => 5000
  }
}

unless File.exist?(db_file)
  puts "SQLite3 database not found at #{db_file}. Rebuilding it."
  require 'fileutils'
  FileUtils.mkdir_p(File.dirname(db_file))
  sqlite_command = %Q{sqlite3 "#{db_file}" "create table a (a integer); drop table a;"}
  puts "Executing '#{sqlite_command}'"
  raise "Seems that there is no sqlite3 executable available" unless system(sqlite_command)
end

ActiveRecord::Base.establish_connection("unit")

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arel-0.3.1 spec/connections/sqlite3_connection.rb
arel-0.3.0 spec/connections/sqlite3_connection.rb
arel-0.2.1 spec/connections/sqlite3_connection.rb
arel-0.2.0 spec/connections/sqlite3_connection.rb
arel-0.2.pre spec/connections/sqlite3_connection.rb
arel-0.1.2 spec/connections/sqlite3_connection.rb