Sunspot 和 RSpec 失败.提交似乎不起作用 [英] Sunspot and RSpec fail. The commit doesn't seem to be working

查看:40
本文介绍了Sunspot 和 RSpec 失败.提交似乎不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些使用 RSpec 为 Rails 站点运行的测试,但尽管如此按照说明操作,事情本身就不太正常.

I've got a few tests running with RSpec for a Rails site, but despite following the instructions things aren't quite behaving themselves.

我通过工厂创建了一篇文章,运行 Sunspot.commit 然后检查结果.我似乎总是画一个空白.当我测试它手动通过控制台或通过网站都可以找到不过.

I create an article via a Factory, run Sunspot.commit and then check the results. I always seem to draw a blank though. When I test it manually via the console or through the website it all works find though.

有什么想法吗?如何输出太阳黑子日志以查看发生了什么?

Any ideas? How can I output the sunspot logs to see what's going on?

我的 Gemfile 有以下内容,我运行的是 Rails 3.1.1

My Gemfile has the following, and I'm running Rails 3.1.1

gem 'sunspot', '1.2.1'
gem 'sunspot_rails'
gem 'sunspot_test'

非常感谢,格雷姆

推荐答案

没有正确阅读手册是我的错.

It was my fault for not reading the manual properly.

https://github.com/collectiveidea/sunspot_test/issues/9

有必要在描述中添加一个魔法位以确保 Solr 已启动.

It's necessary to add a magic bit to the description to make sure that Solr is started.

describe "my nice test", :search => true do
  thing = Factory.create(:thing)
  Sunspot.commit
  # do my search and test
  # now it works!
end

:search => true 很重要.

这篇关于Sunspot 和 RSpec 失败.提交似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆