2015-01-09 40 views
2

这个失败的测试通过我的本地,但在我的远程测试服务器上失败。所以我猜想这可能是有关远程Redis的/ resque配置..Rails错误期望是什么意思?

我的错误读取像这样:

not all expectations were satisfied 
    unsatisfied expectations: 
    - expected exactly once, not yet invoked: Resque Client connected to redis://localhost:6379/0.enqueue(StoreArticulate::Bookmarks, 10, 'SecondBookmark000011101010101') 
    satisfied expectations: 
    - allowed any number of times, not yet invoked: #<Mock:generic pusher channel>.trigger(any_parameters) 
    - allowed any number of times, not yet invoked: Pusher.[](any_parameters) 
    - allowed any number of times, not yet invoked: Panda::Video.find(any_parameters) 
    - allowed any number of times, not yet invoked: Resque Client connected to redis://localhost:6379/0.enqueue(any_parameters) 
test: #bookmarks should update an existing bookmark. (QuizzesControllerTest) 
test/functional/quizzes_controller_test.rb:37:in `block (2 levels) in <class:QuizzesControllerTest>' 

的代码行,这是指内容如下:

should 'update an existing bookmark' do 

    Resque.stubs(:enqueue) 
    Resque.expects(:enqueue).with(StoreArticulate::Bookmarks, @quiz.id, @second_bookmark[0]).once 

    post :state, registration: @quiz.id, method: 'POST', content: @first_bookmark 
    post :state, registration: @quiz.id, method: 'POST', content: @second_bookmark 
end 

有人能解释这里究竟发生了什么问题,我可能会做些什么来补救它?

回答

1
  • 预期正好一次,尚未调用://本地主机:连接到的Redis Resque客户端6379/0.enqueue(StoreArticulate ::书签,10, 'SecondBookmark000011101010101')

我读到,作为远程​​环境中的测试,Resque实际上能够连接到运行在localhost:6379上的Redis。过去,我通过使用类似fakeredis的东西解决了这个问题 - 可能值得一试,而不是试图将Redis本身断开。