Sometimes all I want is a fake object that implements the same interface and can answer some specific questions about how I interact with it in a test.
有时我所希望的是一个伪对象,它实现了与真实对象相同的接口,可以回答关于我在测试中如何与它交互这样一些特定问题。
A mock is a "fake" object that allows you to focus on testing important features within the scope of the Rails project, rather than on interactions with external systems that you have no control over.
mock是一个“伪”对象,它让我们能够集中精力测试Rails项目范围内的重要特性,而不必关注与无法控制的外部系统的交互。
应用推荐