Cucumber and Sunspot
If you haven’t checked out Sunspot yet, you should. I have tried every solution for doing real full-text searching in a Rails app. Sunspot, backed by solr, is the only one that I haven’t had issues with in production. Hopefully I’ll get around to posting more about my experience with it.
But for today, here’s how I got Sunspot working with Cucumber.
First, add a configuration for the cucumber environment in
config/sunspot.yml. I usually just use the same settings as test.
Then, throw this bit of nastiness in the bottom of your env.rb file.
This will start up Sunspot for scenarios tagged with
@search, and mock out the sunspot connection for ones that aren’t.