Sha256: d704c9322fe26319d802f3209c09cc5c823df15b21cd351e33dac1f6f06e996f

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8

require 'ostruct'
require 'sunspot'
require 'sunspot_stats'

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
Dir.glob(File.join(File.dirname(__FILE__), "helpers", "*.rb")).each do |file|
  require file
end
require File.join(File.dirname(__FILE__), 'ext')

RSpec.configure do |config|
  # Mock session available to all spec/api tests
  config.include MockSessionHelper,
                 :type => :api,
                 :example_group => {:file_path => /spec[\\\/]api/}

  # Real Solr instance is available to integration tests
  config.include IntegrationHelper,
                 :type => :integration,
                 :example_group => {:file_path => /spec[\\\/]integration/}

  # Nested under spec/api
  [:indexer, :query, :search].each do |spec_type|
    helper_name = "#{spec_type}_helper"

    config.include Sunspot::Util.full_const_get(Sunspot::Util.camel_case(helper_name)),
                   :type          => spec_type,
                   :example_group => {:file_path => /spec[\\\/]api[\\\/]#{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

5 entries across 5 versions & 1 rubygems

Version Path
sunspot_stats-0.0.7 spec/spec_helper.rb
sunspot_stats-0.0.6 spec/spec_helper.rb
sunspot_stats-0.0.5 spec/spec_helper.rb
sunspot_stats-0.0.4 spec/spec_helper.rb
sunspot_stats-0.0.3 spec/spec_helper.rb