Sha256: d61723b10c4f620a0dfec8d6f76006af4ffdde7ec8f72a49ea001d6f44908cf6

Contents?: true

Size: 1.62 KB

Versions: 6

Compression:

Stored size: 1.62 KB

Contents

using_gems = false

if rsolr_gem_version = ENV['RSOLR_GEM_VERSION']
  STDERR.puts("Forcing rsolr gem version #{rsolr_gem_version}")
  using_gems = true
  require 'rubygems'
  gem 'rsolr', rsolr_gem_version
end

begin
  require 'spec'
  begin
    require 'ruby-debug'
  rescue LoadError => e
    if using_gems
      module Kernel
        def debugger
          STDERR.puts('Debugger is not available')
        end
      end
    else
      raise(e)
    end
  end
  if ENV['USE_WILL_PAGINATE']
    require 'will_paginate'
    require 'will_paginate/collection'
  end
rescue LoadError => e
  require 'rubygems'
  if using_gems
    raise(e)
  else
    using_gems = true
    retry
  end
end
require 'ostruct'

unless gem_name = ENV['SUNSPOT_TEST_GEM']
  $:.unshift(File.dirname(__FILE__) + '/../lib')
else
  gem gem_name
end
require 'sunspot'

require File.join(File.dirname(__FILE__), 'mocks', 'mock_record.rb')
Dir.glob(File.join(File.dirname(__FILE__), 'mocks', '**', '*.rb')).each do |file|
  require file unless File.basename(file) == 'mock_record.rb'
end
require File.join(File.dirname(__FILE__), 'ext')

Spec::Runner.configure do |config|
  Dir.glob(File.join(File.dirname(__FILE__), 'helpers', '*_helper.rb')).each do |helper|
    helper_name = File.basename(helper, File.extname(helper))
    spec_type = helper_name.sub(/_helper$/, '').to_sym
    require(helper)
    config.include(
      Sunspot::Util.full_const_get(Sunspot::Util.camel_case(helper_name)),
      :type => spec_type
    )
  end
end

def without_class(clazz)
  Object.class_eval { remove_const(clazz.name.to_sym) }
  yield
  Object.class_eval { const_set(clazz.name.to_sym, clazz) }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sunspot-1.0.5 spec/spec_helper.rb
sunspot-1.0.4 spec/spec_helper.rb
sunspot-1.0.3 spec/spec_helper.rb
sunspot-1.0.2 spec/spec_helper.rb
sunspot-1.0.1 spec/spec_helper.rb
sunspot-1.0.0 spec/spec_helper.rb