Sha256: 063d13b0d2277c9cd730d4892b6f5b20091ff30f34a91de1250fbfc3b2713b82

Contents?: true

Size: 1.62 KB

Versions: 52

Compression:

Stored size: 1.62 KB

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')
plugin_test_dir = File.dirname(__FILE__)

require 'rubygems'
require 'bundler/setup'

require 'rspec'
require 'logger'

require 'action_controller' # rspec-rails needs this :(
require 'closure_tree'
require 'tmpdir'

#log = Logger.new(STDOUT)
#log.sev_threshold = Logger::DEBUG
#ActiveRecord::Base.logger = log

require 'yaml'
require 'erb'
ENV["DB"] ||= "mysql"
ActiveRecord::Base.table_name_prefix = ENV['DB_PREFIX'].to_s
ActiveRecord::Base.table_name_suffix = ENV['DB_SUFFIX'].to_s
ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read(plugin_test_dir + "/db/database.yml")).result)
ActiveRecord::Base.establish_connection(ENV["DB"])
ActiveRecord::Migration.verbose = false
require 'db/schema'
require 'support/models'
require 'rspec/rails' # TODO: clean this up-- I don't want to pull the elephant through the mouse hole just for fixture support

DB_QUERIES = []

ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
  def log_with_query_append(query, *args, &block)
    DB_QUERIES << query
    log_without_query_append(query, *args, &block)
  end

  alias_method_chain :log, :query_append
end

Thread.abort_on_exception = true

RSpec.configure do |config|
  config.fixture_path = "#{plugin_test_dir}/fixtures"
  # true runs the tests 1 second faster, but then you can't
  # see what's going on while debuggering with different db connections.
  config.use_transactional_fixtures = false
  config.after(:each) do
    DB_QUERIES.clear
  end
  config.before(:all) do
    ENV['FLOCK_DIR'] = Dir.mktmpdir
  end
  config.after(:all) do
    FileUtils.remove_entry_secure ENV['FLOCK_DIR']
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
lalala-4.0.0.dev.136 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.135 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.134 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.133 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.132 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.131 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.129 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.128 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.126 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.125 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.124 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.123 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.118 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.116 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.114 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.113 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.111 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.109 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.107 vendor/deps/closure_tree/spec/spec_helper.rb
lalala-4.0.0.dev.94 vendor/deps/closure_tree/spec/spec_helper.rb