Ruby rspec使用参数和返回固定值的新语法存根方法
我想用参数1存根对象A以响应接下来的消息,并返回B字符串Ruby rspec使用参数和返回固定值的新语法存根方法,ruby,rspec,rspec3,Ruby,Rspec,Rspec3,我想用参数1存根对象A以响应接下来的消息,并返回B字符串 我想用新的rspec语法A.allow编写A.stub:next.with1.and_returnB行。。。但是我找不到添加with part的位置这就是新语法的工作原理: allow(A).to receive(:next).with(1).and_return("B") allow(A).to receive(:next).with(1).and_return("B")
我想用新的rspec语法A.allow编写A.stub:next.with1.and_returnB行。。。但是我找不到添加with part的位置这就是新语法的工作原理:
allow(A).to receive(:next).with(1).and_return("B")
allow(A).to receive(:next).with(1).and_return("B")