2015-01-09 62 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本身斷開。