Sha256: 5442b98c5d07bad7fee3bc77e8a672f8c6ce47bd72948f24a71752df875074ae

Contents?: true

Size: 1.39 KB

Versions: 8

Compression:

Stored size: 1.39 KB

Contents

$:.unshift File.dirname(__FILE__) + '/../lib'
Dir[File.join(File.dirname(__FILE__), '../vendor/*/lib')].each do |path|
  $:.unshift path
end

require 'rubygems'
require 'fileutils'
require 'bundler'

Bundler.require :default, :development

require "#{File.dirname(__FILE__)}/sphinx_helper"

ActiveRecord::Base.logger = Logger.new(StringIO.new)

RSpec.configure do |config|
  %w( tmp tmp/config tmp/log tmp/db ).each do |path|
    FileUtils.mkdir_p "#{Dir.pwd}/#{path}"
  end

  Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/tmp" unless defined?(RAILS_ROOT)

  sphinx = SphinxHelper.new
  sphinx.setup_mysql

  require "#{File.dirname(__FILE__)}/fixtures/models"
  ThinkingSphinx.context.define_indexes

  config.before :each do
    %w( tmp tmp/config tmp/log tmp/db ).each do |path|
      FileUtils.mkdir_p "#{Dir.pwd}/#{path}"
    end

    ThinkingSphinx.updates_enabled = true
    ThinkingSphinx.deltas_enabled = true
    ThinkingSphinx.suppress_delta_output = true

    ThinkingSphinx::Configuration.instance.reset
  end

  config.after :all do
    FileUtils.rm_r "#{Dir.pwd}/tmp" rescue nil
  end
end

def minimal_result_hashes(*instances)
  instances.collect do |instance|
    {
      :weight     => 21,
      :attributes => {
        'sphinx_internal_id'    => instance.id,
        'sphinx_internal_class' => instance.class.name,
        'class_crc'             => instance.class.name.to_crc32
      }
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
thinking-sphinx-1.4.14 spec/spec_helper.rb
thinking-sphinx-1.4.13 spec/spec_helper.rb
thinking-sphinx-1.4.12 spec/spec_helper.rb
thinking-sphinx-1.4.11 spec/spec_helper.rb
thinking-sphinx-1.4.10 spec/spec_helper.rb
thinking-sphinx-1.4.9 spec/spec_helper.rb
thinking-sphinx-1.4.8 spec/spec_helper.rb
thinking-sphinx-1.4.7 spec/spec_helper.rb