我希望能够期望Minitest中具有不同参数的同一方法的多次调用。
想象一下方法和类的定义:
class TicketSeller
def complete
EventHandler.trigger(:payment_processed)
EventHandler.trigger(:ticket_sold)
end
end
我希望以下测试通过:
test "triggers events :payment_processed and :ticket_sold" do
# set up expectations
EventHandler.expects(:trigger).with(:payment_processed)
EventHandler.expects(:trigger).with(:ticket_sold)
# invoke method
TicketSeller.new.complete
end
相反,我收到如下错误:
--- expected
+++ actual
@@ -1 +1 @@
-:payment_processed
+:ticket_sold