我正在尝试使用 rspec 测试确认在控制器方法中调用了一个函数。为此,我遵循relishapp 文档来设置消息期望。
但是,我无法将此代码段添加到spec_helper.rb
:
config.mock_with :rspec do |mocks|
mocks.syntax = :should
end
虽然只是config.mock_with :rspec
已经在文件中并且没有引起任何问题,但添加上面的代码片段并运行 rspec 会导致出现以下错误:
You are using WebMock 1.12.3. VCR is known to work with WebMock >= 1.8.0, < 1.12. It may not work with this version.
/Users/user/rails_projects/project/spec/spec_helper.rb:100:in `block (2 levels) in <top (required)>': undefined method `syntax=' for #<RSpec::Mocks::Configuration:memory_location> (NoMethodError)
我该如何解决这个问题?