Stubbing Thinking Sphinx with RSpec
This is probably pretty basic, but I can't seem to figure it out. I have Thinking Sphinx set up and running, but when I go to run my rspec tests, I get an undefined method error:
`method_missing': undefined method `define_index' for #<Class:0x000001010ecb38> (NoMethodError)
Looks like it just doesn't like the indexes I defined on the models... I saw this article, but I'm not using Cucumber. How do I fix this?
RSpec 2.3.1, Sphinx 开发者_C百科1.10-beta, Thinking Sphinx 2.0.0, Rails 3.0.5.
Turns out the method_missing
error was a bit of a red herring. I never set up sphinx to run in test. I ended up having to change my database.yml
file to use mysql, and set that whole thing up. Running sphinx with
rake thinking_sphinx:start RAILS_ENV=test
And then running my tests took care of it. Kind of annoying, but I guess that's the way it's gotta be.
精彩评论