Sha256: 9943ef2165dda401edb171dac5418c1026acaf9f836aa5a325430e1490df85a0

Contents?: true

Size: 1.61 KB

Versions: 13

Compression:

Stored size: 1.61 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
    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

13 entries across 13 versions & 1 rubygems

Version Path
modalfields-1.2.2 test/helper.rb
modalfields-1.2.1 test/helper.rb
modalfields-1.2.0 test/helper.rb
modalfields-1.1.11 test/helper.rb
modalfields-1.1.10 test/helper.rb
modalfields-1.1.9 test/helper.rb
modalfields-1.1.8 test/helper.rb
modalfields-1.1.7 test/helper.rb
modalfields-1.1.6 test/helper.rb
modalfields-1.1.5 test/helper.rb
modalfields-1.1.4 test/helper.rb
modalfields-1.1.3 test/helper.rb
modalfields-1.1.2 test/helper.rb