forked from sunspot/sunspot
-
Notifications
You must be signed in to change notification settings - Fork 36
RSpec and Sunspot
jcf edited this page Sep 13, 2010
·
13 revisions
If you want to prevent any test from running a solr search, which you probably do, you can do so within your `spec_helper.rb` as opposed to having to do it in lots of `describe` blocks. The code below has been tested and works with sunspot/sunspot-rails v1.0.3.
require ‘sunspot/rails/spec_helper’ Spec::Runner.configure do |config| config.before(:each) do ::Sunspot.session = ::Sunspot::Rails::StubSessionProxy.new(::Sunspot.session) end config.after(:each) do ::Sunspot.session = ::Sunspot.session.original_session end end