我对Rspec和Rails相当新。我想测试如果运行方法没有运行,并且确认为true,则不会调用execute方法。我应该怎么写这个rspec测试?
class Release
def run(confirm=false)
execute if confirm
end
def execute
# do something
end
端
答案 0 :(得分:0)
it "should not execute without confirmation" do
release = Release.new
release.run
expect(release).not_to have_received(:execute)
end