问题描述
我正在尝试使用2.14版本的rspec执行测试用例,而我却遇到以下错误
I am trying execute test cases with rspec version 2.14 for which I am getting following error
undefined method `rspec_reset' for
我正在尝试在类上使用rspec_reset.相同的测试用例正在使用rspec 2.13.1.那么是否有可能在2.13之后不提供rspec_reset方法?
I am trying to use rspec_reset on the class. The same test cases are working with rspec 2.13.1. So is it possible that rspec_reset method is not available after 2.13?
推荐答案
是的,在2.14中,rspec_reset
不再像以前一样在所有对象上可用,如 https://github.com/rspec/rspec-mocks/pull/250 .
Yes, in 2.14, rspec_reset
is no longer available on all objects as it was previously, as discussed in https://github.com/rspec/rspec-mocks/pull/250.
尽管我找不到任何文档,但是现在似乎有一个RSpec
类方法reset
,该方法将对象作为参数,并将有效地撤消"已对该对象执行的所有RSpec操作对象.
Although I can't find any documentation on it, there now appears to be an RSpec
class method reset
which takes an object as an argument and will effectively "undo" any RSpec operations that have been done to that object.
在 https上有一个RSpec示例" ://github.com/rspec/rspec-mocks/blob/cee433c89125a3984df33c87eb61985613adce9b/spec/rspec/mocks/mock_spec.rb 在示例说明中仍使用rspec_reset
,但现在使用前面提到的reset
方法进行重置.在该示例的早期版本中,重置是使用rspec_reset
完成的.
There's an RSpec "example" at https://github.com/rspec/rspec-mocks/blob/cee433c89125a3984df33c87eb61985613adce9b/spec/rspec/mocks/mock_spec.rb which still uses the rspec_reset
in the description of the example, but which now uses the aforementioned reset
method to do the reset. In earlier versions of the example, the reset was done with rspec_reset
.
这篇关于带有rspec 2.14版本的未定义方法`rspec_reset'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!