Mock Chef::ReservedNames::Win32::Version.new in Ch

2019-09-07 16:53发布

问题:

I found Fauxhai works for mocking the information in "node" but it doesn't mock Chef::ReservedNames::Win32::Version.new.

Is there anyway to mock this?

回答1:

Standard RSpec applies so allow(Chef::ReservedNames::Win32::Version).to receive(:new).and_return(double('fake version')) or similar.