rspec 单元测试问题,当测试自己所写的方法的时候一直提示错误

在使用rspec做单元测试的时候 当测试自己所写的方法的时候一直提示错误

最后的解决方法就是一定要使方法返回true

例如:

def set_agent_value
    if self.agent.nil?
        self.agent = false
    end
    true
end

  

原文地址:https://www.cnblogs.com/tomtang/p/5154748.html