gpt4 book ai didi

ruby-on-rails - 这个 Rails 错误预期是什么意思?

转载 作者:IT王子 更新时间:2023-10-29 06:06:44 26 4
gpt4 key购买 nike

这个失败的测试在我的本地通过得很好,但在我的远程测试服务器上它失败了。所以我假设这可能与远程 redis/resque 配置有关..

我的错误是这样写的:

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>'

这行代码,this指的是这样写的:

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

有人可以解释这里到底出了什么问题以及我可以做些什么来补救它吗?

最佳答案

  • expected exactly once, not yet invoked: Resque Client connected to redis://localhost:6379/0.enqueue(StoreArticulate::Bookmarks, 10, 'SecondBookmark000011101010101')

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

关于ruby-on-rails - 这个 Rails 错误预期是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27854325/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com