Created
August 17, 2010 16:34
-
-
Save bartocc/530703 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before("~@search") do | |
Sunspot.session = Sunspot::Rails::StubSessionProxy.new(Sunspot.session) | |
end | |
# make sure that pickle calls #index! on our appropriate models | |
require File.join(File.dirname(__FILE__), 'pickle') | |
module Pickle | |
module Session | |
def create_model_with_sunspot(a_model_name, fields = nil) | |
result = create_model_without_sunspot(a_model_name, fields) | |
model = model(a_model_name) | |
model.index! if model.respond_to?(:index!) | |
result | |
end | |
alias_method_chain :create_model, :sunspot | |
end | |
end | |
# clean out the Solr index after each scenario | |
After do | |
Admin.remove_all_from_index! | |
Product.remove_all_from_index! | |
Country.remove_all_from_index! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment