Sha256: efa598cadc114351b4d6bb6e673a28761708f32716d901b707a6fc4b2b974959

Contents?: true

Size: 1.62 KB

Versions: 17

Compression:

Stored size: 1.62 KB

Contents

require 'rubygems'
require 'bundler'
begin
  Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
  $stderr.puts e.message
  $stderr.puts "Run `bundle install` to install missing gems"
  exit e.status_code
end
require 'test/unit'
require 'shoulda'
require 'active_support'
require 'active_record'
require 'logger'

require 'active_support/core_ext/hash'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'modalfields'

class Test::Unit::TestCase
end

ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) # + '/../../../..'

# require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))

module Rails
  def self.root
    Pathname(ENV['RAILS_ROOT'])
  end
  def version
    ActiveRecord::VERSION::STRING
  end
end

def load_schema
  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml')).with_indifferent_access
  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 'sqlite3'
      'sqlite3'
      rescue MissingSourceFile
    end

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

  require File.dirname(__FILE__) + '/create_database'
  create_database config[db_adapter]

  ActiveRecord::Base.establish_connection(config[db_adapter])
  load(File.dirname(__FILE__) + "/schema.rb")
  require File.dirname(__FILE__) + '/../lib/modalfields'
  ModalFields.enable
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
modalfields-1.5.7 test/helper.rb
modalfields-1.5.6 test/helper.rb
modalfields-1.5.5 test/helper.rb
modalfields-1.5.4 test/helper.rb
modalfields-1.5.3 test/helper.rb
modalfields-1.5.2 test/helper.rb
modalfields-1.5.1 test/helper.rb
modalfields-1.5.0 test/helper.rb
modalfields-1.4.7 test/helper.rb
modalfields-1.4.6 test/helper.rb
modalfields-1.4.5 test/helper.rb
modalfields-1.4.4 test/helper.rb
modalfields-1.4.3 test/helper.rb
modalfields-1.4.2 test/helper.rb
modalfields-1.4.1 test/helper.rb
modalfields-1.4.0 test/helper.rb
modalfields-1.3.0 test/helper.rb