我有以下rspec示例:
describe "with spike" do
it "succeeds" do
a = double('whatever')
a.should_receive(:b).with(true)
a.b('not false')
end
end
如何让with
接受任何非假参数?
答案 0 :(得分:1)
只需编写一个任意的消息处理程序:
describe "with spike" do
it "succeeds" do
a = double('whatever')
a.should_receive(:b) { |x|
x.should_not be_false
}
a.b('not false')
end
end