Acts as Solr 3x Performance Boost on Tests

ruby testing tdd bdd acts_as_solr performance

06|09|2009

If you're using acts_as_solr and not disabling it on your tests, or want to enable or disable it selectively, try my fork of mattmatt-acts_as_solr on http://github.com/cyx/acts_as_solr.

In a nutshell, you put this in your test_helper:

ActsAsSolr::Post.strategy :fake

Then in your tests where you want to enable and disable it after just do (assuming you're using test/unit):

def setup
  ActsAsSolr::Post.strategy :real
end

def teardown
  ActsAsSolr::Post.strategy :fake
end

Note: If you're using RSpec / Bacon / <insert testing framework here>, this won't be a problem, just replace the code above with before / after, setup /teardown blocks etc etc

blog comments powered by Disqus