1
class Post
def save
Mailer.notify!('bla')
true
end
end
如何測試當post.save
被調用時,Mailer.notify
方法被觸發?並有正確的論點。如何使用Minitest調用某個方法?
使用RSpec我通常做的:
expect(Mailer).to receive(:notify!).with('bla')
post.save
預先感謝您!