使用 RSpec 测试 Thinking Sphinx
这可能是非常基本的,但我似乎无法弄清楚。我已经设置并运行 Thinking Sphinx,但是当我去运行 rspec 测试时,我收到未定义的方法错误:
`method_missing': undefined method `define_index' for #<Class:0x000001010ecb38> (NoMethodError)
看起来它只是不喜欢我在模型上定义的索引...我看到了这篇文章,但是我没有使用黄瓜。我该如何解决这个问题?
RSpec 2.3.1、Sphinx 1.10-beta、Thinking Sphinx 2.0.0、Rails 3.0.5。
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 1.10-beta, Thinking Sphinx 2.0.0, Rails 3.0.5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,
method_missing
错误有点转移注意力。我从未设置过 sphinx 在测试中运行。我最终不得不更改我的database.yml文件以使用mysql,并设置整个事情。运行 sphinx然后运行我的测试就解决了。有点烦人,但我想事情就是这样。
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 mydatabase.yml
file to use mysql, and set that whole thing up. Running sphinx withAnd then running my tests took care of it. Kind of annoying, but I guess that's the way it's gotta be.