Closed bheuvel closed 8 years ago
Fixed the rspec tests with PR #55
Perhaps the way to get these into Travis (not Windows dependent) is to wrap some Windows (gem) specifc code into small classes/module so that that specicf part can be mocked in rspec?
I think we should run in appveyor rather than travis
Hello,
I personally chose to not use Win32/Version which relies on win32 API calls, but instead rely on ohai - which are computed via win32 api calls. I created a small library - currently in ms_dotnet cookbook - allowing me to easily use windows ohai.
This way, you can easily mock ohais in rspec! What do you think?
As of commit https://github.com/chef-cookbooks/powershell/commit/980227d8cd0c057a5b4c7b43c31456d58862bf2d the Travis build is failing.
Tried looking into this and it seems to crash on (e.g.)
require 'chef/win32/version'
, really on the include itself. When looking at this discussion, https://github.com/sethvargo/chefspec/issues/405, certain OS specific recipes can't be tested on other OS'ses, such as recipe for Windows on Travis/Linux.This at least seems to be true for all recipe tests requiring (
require 'chef/win32/version'
).When fixing this there seems to be two roads to start on:
describe 'powershell::powershell2', :windows_only do
) and pass--tag unix_only
to Travis/rspec, effectively NOT running most tests.The latter needs some more (or better :wink:) work as my experience is that the
require 'chef/win32/version'
needs to by copied/duplicated down to (every)before do
block, or else it will still be evaluated/included and causes a crash.Am willing to fix this, but need some advise on this.
@tas50 @jaym any thoughts?
PS Too bad these rspec tests can't run, as for example some are broken since commit https://github.com/chef-cookbooks/powershell/commit/c369803dbb75639ca0f769ca922268418bc4bafb