Sha256: f5e9e4693fec73951dd46979e72467b702b2830b4c589197878f5447e9348f89

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

begin
  require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
rescue LoadError
  puts "You need to install rspec in your base app"
  exit
end

plugin_spec_dir = File.dirname(__FILE__)
ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")

def load_schema
  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
  ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")

  db_adapter = ENV['DB']
  # no db passed, try one of these fine config-free DBs before bombing.
  db_adapter ||=
    begin
      require 'rubygems'
      require 'sqlite'
      'sqlite'
    rescue MissingSourceFile
      begin
        require 'sqlite3'
        'sqlite3'
      rescue MissingSourceFile
      end
    end

  if db_adapter.nil?
    raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
  end

  ActiveRecord::Base.establish_connection(config[db_adapter])
  load(File.dirname(__FILE__) + "/db/schema.rb")
  require File.dirname(__FILE__) + '/../init.rb'
end
require File.dirname(__FILE__) + '/test_models.rb'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ar-simple-idmap-0.1.6 spec/spec_helper.rb
ar-simple-idmap-0.1.5 spec/spec_helper.rb
ar-simple-idmap-0.1.4 spec/spec_helper.rb
ar-simple-idmap-0.1.3 spec/spec_helper.rb
ar-simple-idmap-0.1.2 spec/spec_helper.rb
ar-simple-idmap-0.1.1 spec/spec_helper.rb
ar-simple-idmap-0.1.0 spec/spec_helper.rb