【问题标题】:Mock Chef::ReservedNames::Win32::Version.new in Chef unit/rspec test?在 Chef 单元/rspec 测试中模拟 Chef::ReservedNames::Win32::Version.new?
【发布时间】:2016-01-22 07:26:40
【问题描述】:

我发现 Fauxhai 可以模拟“节点”中的信息,但它不能模拟 Chef::ReservedNames::Win32::Version.new。

还有什么可以模拟的吗?

【问题讨论】:

    标签: windows rspec chef-infra chefspec


    【解决方案1】:

    标准 RSpec 适用于allow(Chef::ReservedNames::Win32::Version).to receive(:new).and_return(double('fake version')) 或类似。

    【讨论】:

    • 我已经尝试过这个解决方案,虽然我不知道我这样做是否正确。更多详情请看我的question。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多