Sha256: a35fb78a62bfec61c1b3a3245ec5dbe2c370c85fbc8f7e69638b5138a9b18bb7

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] ||= File.join(File.dirname(__FILE__), 'mock_app')

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

require 'spec'
require 'spec/rails'
require 'rake'
require 'ruby-debug' unless RUBY_VERSION > '1.9'
require 'sunspot/rails/tasks'

def load_schema
  stdout = $stdout
  $stdout = StringIO.new # suppress output while building the schema
  load File.join(ENV['RAILS_ROOT'], 'db', 'schema.rb')
  $stdout = stdout
end

def silence_stderr(&block)
  stderr = $stderr
  $stderr = StringIO.new
  yield
  $stderr = stderr
end

Spec::Runner.configure do |config|
  config.before(:each) do
    Sunspot.remove_all
    Sunspot.commit
    load_schema
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adamsalter-sunspot_rails-0.10.5 spec/spec_helper.rb