Sha256: 0b3b561683b41a4c50e2ad68166ab125c5e8a49b4193e04cea13586f3b6d637a

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'sqlite3'

begin
  require 'ruby-debug'
  Debugger.start
  Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings)
rescue LoadError
  # ruby-debug wasn't available so neither can the debugging be
end


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

require 'factory_data_preloader'

ActiveRecord::Base.establish_connection({ :database => ":memory:", :adapter => 'sqlite3', :timeout => 500 })

module OutputCapturer
  # borrowed from zentest assertions...
  def self.capture
    require 'stringio'
    orig_stdout = $stdout.dup
    orig_stderr = $stderr.dup
    captured_stdout = StringIO.new
    captured_stderr = StringIO.new
    $stdout = captured_stdout
    $stderr = captured_stderr
    yield
    captured_stdout.rewind
    captured_stderr.rewind
    return captured_stdout.string, captured_stderr.string
  ensure
    $stdout = orig_stdout
    $stderr = orig_stderr
  end
end

module FactoryDataPreloader
  def self.reset!
    self.preload_all = true
    self.preload_types = []

    preloaders = Array.new(FactoryDataPreloader::AllPreloaders.instance)
    preloaders.each do |preloader|
      preloader.remove!
    end

    FactoryData.reset_cache!
  end
end

require 'lib/schema'
require 'lib/models'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
factory_data_preloader-1.0.2 test/test_helper.rb
factory_data_preloader-1.0.1 test/test_helper.rb