rodjek / rspec-puppet

RSpec tests for your Puppet manifests
http://rspec-puppet.com
MIT License
364 stars 203 forks source link

windows custom fact requiring win32ole fails on linux #795

Open jessereynolds opened 4 years ago

jessereynolds commented 4 years ago

I have a module containing a custom fact that requires win32ole. This fails on linux.

I can fix this if I add 'win32/resolv' and 'win32ole' to the list of ruby gems to fake out the requiring of in lib/rspec-puppet/monkey_patches.rb.

Is this the best way to fix this? I can submit a PR...

johnrogers00 commented 3 years ago

We also encountered this error, and wondered what is the best way to fix it. Currently I just create an empty ./lib/win32ole.rb file in my pdk project and it allows me to handle the require 'win32ole' statement in the fact. I am not sure if this is best practice or not, but considering we have to mock all of the method calls anyway, I was not able to find a way to mock the require 'win32ole' statement in the fact to avoid having to have the empty file on disk