Sha256: 92852e20d0403eb8dcd16ca90660755a103fd3ccb0b89d1575e49eea76e1c4f8

Contents?: true

Size: 934 Bytes

Versions: 5

Compression:

Stored size: 934 Bytes

Contents

ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + '/../../../../config/environment')
require 'logger'
require 'test_help'

plugin_path = RAILS_ROOT + "/vendor/plugins/migration_test_helper"

config_location = File.expand_path(plugin_path + "/test/config/database.yml")

config = YAML::load(ERB.new(IO.read(config_location)).result)
ActiveRecord::Base.logger = Logger.new(plugin_path + "/test/log/test.log")
ActiveRecord::Base.establish_connection(config['test'])

Test::Unit::TestCase.fixture_path = plugin_path + "/test/fixtures/"

$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)

class Test::Unit::TestCase
  def plugin_path(path)
    File.expand_path(File.dirname(__FILE__) + '/../' + path)  
  end

  def load_default_schema
    ActiveRecord::Migration.suppress_messages do
      schema_file = plugin_path("/test/db/schema.rb")
      load(schema_file) if File.exist?(schema_file)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
migration_test_helper-0.1.0 test/helper.rb
migration_test_helper-1.0.0 test/helper.rb
migration_test_helper-1.1.0 test/helper.rb
migration_test_helper-1.2.0 test/helper.rb
migration_test_helper-1.2.1 test/helper.rb