我知道以下事情有效:
返回一个参数
subject.should_receive(:get_user_choice){ |choices| choices.to_a[0] }
和一个序列(第一次调用时返回 0,第二次“退出”时返回)
subject.should_receive(:get_user_choice).and_return(0, "exit")
但如何将它们结合起来呢?
如果我想第一次返回参数然后返回“exit”怎么办
或者:
subject.should_receive(:get_user_choice).ordered.and_return { |choices| choices.to_a[0] }
subject.should_receive(:get_user_choice).ordered.and_return { "exit" }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)