文件名称:假:Ruby的伪造库
文件大小:103KB
文件格式:ZIP
更新时间:2024-03-11 13:26:07
Ruby
虚假 虚假旨在通过确保您不存根或模拟对象中实际不存在的模拟方法来使单元测试更加可靠。 例子 class PostRepository def store ( title ) # save a new post in the database end end class PostAdder < Struct . new ( :post_repository ) def add ( title ) post = post_repository . store ( title ) # do some stuff with the post end end require 'bogus/rspec' describe PostAdder do fake ( :post_repository ) it "stores the post" do