Permalink
Browse files

How to set it up with Spork

  • Loading branch information...
1 parent 76ec76b commit 12e62b6bab99b3fb17d2f07725cdd312f468965b @justinko committed Sep 28, 2011
Showing with 22 additions and 1 deletion.
  1. +22 −1 README.md
View
@@ -15,7 +15,7 @@ Here is an example RSpec 2 spec_helper.rb:
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
end
- config.before :solr => true do
+ config.before :each, :solr => true do
Sunspot::Rails::Tester.start_original_sunspot_session
Sunspot.session = $original_sunspot_session
Sunspot.remove_all!
@@ -51,6 +51,27 @@ Here is an example spec that utilizes sunspot-rails-tester:
end
end
+## Spork
+
+To get this gem to work with Spork, all you need to do is move the `start_original_sunspot_session`
+line out of the `RSpec.configure` block:
+
+ $original_sunspot_session = Sunspot.session
+ Sunspot::Rails::Tester.start_original_sunspot_session
+
+ RSpec.configure do |config|
+ config.mock_with :rspec
+
+ config.before do
+ Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
+ end
+
+ config.before :each, :solr => true do
+ Sunspot.session = $original_sunspot_session
+ Sunspot.remove_all!
+ end
+ end
+
## Thanks
The following articles served as guidance and inspiration for this gem:

0 comments on commit 12e62b6

Please sign in to comment.