Sha256: e22c409b1017c64ad0bdb8c2fc666b1d9c2c1cb0c28e8b36588e9af98f3d260d

Contents?: true

Size: 938 Bytes

Versions: 18

Compression:

Stored size: 938 Bytes

Contents

require 'support/active_record/database_setup'
require 'support/data_mapper/schema_setup'

module DataMapperSQLite3Helper

  puts "DataMapper #{DataMapper::VERSION}, sqlite3"

  def default_config
    db_config['sqlite3']
  end

  def create_db
    @encoding = default_config['encoding'] || ENV['CHARSET'] || 'utf8'
    begin
      establish_connection(default_config.merge('database' => 'sqlite3', 'schema_search_path' => 'public'))
    rescue Exception => e
      $stderr.puts e, *(e.backtrace)
      $stderr.puts "Couldn't create database for #{default_config.inspect}"
    end
  end

  def establish_connection(config = default_config)
    DataMapper.setup(:default, config)
  end

  def data_mapper_sqlite3_setup
    create_db
    establish_connection
    data_mapper_load_schema
  end

  def data_mapper_sqlite3_connection
    DataMapper.repository.adapter
  end
end

RSpec.configure do |c|
  c.include(DataMapperSQLite3Helper)
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
database_cleaner-1.6.2 spec/support/data_mapper/sqlite3_setup.rb
database_cleaner-1.6.1 spec/support/data_mapper/sqlite3_setup.rb
database_cleaner-1.6.0 spec/support/data_mapper/sqlite3_setup.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/support/data_mapper/sqlite3_setup.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/support/data_mapper/sqlite3_setup.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/support/data_mapper/sqlite3_setup.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/support/data_mapper/sqlite3_setup.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/support/data_mapper/sqlite3_setup.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/support/data_mapper/sqlite3_setup.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/support/data_mapper/sqlite3_setup.rb
database_cleaner-1.5.3 spec/support/data_mapper/sqlite3_setup.rb
database_cleaner-1.5.2 spec/support/data_mapper/sqlite3_setup.rb
database_cleaner-1.5.1 spec/support/data_mapper/sqlite3_setup.rb
database_cleaner-1.5.0 spec/support/data_mapper/sqlite3_setup.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/database_cleaner-1.4.1/spec/support/data_mapper/sqlite3_setup.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/database_cleaner-1.4.1/spec/support/data_mapper/sqlite3_setup.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/database_cleaner-1.4.1/spec/support/data_mapper/sqlite3_setup.rb
database_cleaner-1.4.1 spec/support/data_mapper/sqlite3_setup.rb