在Chef单元/ rspec测试中模拟Chef :: ReservedNames :: Win32 :: Version.new? [英] Mock Chef::ReservedNames::Win32::Version.new in Chef unit/rspec test?
本文介绍了在Chef单元/ rspec测试中模拟Chef :: ReservedNames :: Win32 :: Version.new?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现Fauxhai可以在节点中模拟信息,但它不能模拟Chef :: ReservedNames :: Win32 :: Version.new。
I found Fauxhai works for mocking the information in "node" but it doesn't mock Chef::ReservedNames::Win32::Version.new.
是
推荐答案
适用标准RSpec,因此 allow(Chef :: ReservedNames :: Win32 :: Version)。接收(:new).and_return(double('fake version'))
或类似的
Standard RSpec applies so allow(Chef::ReservedNames::Win32::Version).to receive(:new).and_return(double('fake version'))
or similar.
这篇关于在Chef单元/ rspec测试中模拟Chef :: ReservedNames :: Win32 :: Version.new?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文