bitsandbit.es - Bits & Bites

Description: Food. Programming. Bliss.

tire (604) rails (575) elasticsearch (100) ror (75) unit testing (31)

Example domain paragraphs

Food. Programming. Bliss.

I’ve been working a lot recently with ElasticSearch and the fantastic Tire gem.  Trying to stay true to my test first philosophy, I spent some time trying to figure out how to get Tire to work just right with RSpec, but encountered a few issues along the way (which were thankfully all solvable).  

The first issue I encountered with using Tire in RSpec was the need to clean out the elasticsearch index between every test.  This was easily fixed by deleting the index before each run in the spec_helper.rb as below: