0

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?

chief7
  • 14,263
  • 14
  • 47
  • 80

1 Answers1

1

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

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • I've tried this solution, although I don't know if I am doing this correctly. For more details, please see my [question](http://stackoverflow.com/questions/40112870/mock-chefreservednameswin32version-new-in-chef-unit-rspec-test-continued "Mock Chef::ReservedNames::Win32::Version.new in Chef unit/rspec test? [continued]"). Thanks! – Matthew Oct 18 '16 at 16:01