Sha256: 0c96a103cc78f01f566cbf04092d07e1cff11db58f0e487a5ff93750e441e17d
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' require 'mixlib/shellout' describe 'powershell::dsc' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'windows', version: '2012') do |node| node.set['ms_dotnet']['v4']['version'] = '4.5' end.converge(described_recipe) end before do winrm_cmd = double('winrm_cmd', run_command: nil, stdout: 'Transport = HTTPS') allow(Mixlib::ShellOut).to receive(:new).with('powershell.exe winrm enumerate winrm/config/listener').and_return winrm_cmd allow(Chef::Win32::Registry).to receive(:new).and_return double('registry', data_exists?: false, value_exists?: false, key_exists?: false) end context 'When listener is enabled' do before do dsc_cmd = double('dsc_cmd', run_command: nil, exitstatus: 1) allow(Mixlib::ShellOut).to receive(:new).with('powershell.exe winrm get winrm/config/listener?Address=*+Transport=HTTP').and_return dsc_cmd end it 'runs dsc_script' do expect(chef_run).to include_recipe('powershell::powershell4') expect(chef_run).to include_recipe('powershell::winrm') end end context 'When listener is disabled' do before do dsc_cmd = double('dsc_cmd', run_command: nil, exitstatus: 0) allow(Mixlib::ShellOut).to receive(:new).with('powershell.exe winrm get winrm/config/listener?Address=*+Transport=HTTP').and_return dsc_cmd end it 'runs dsc_script' do expect(chef_run).to include_recipe('powershell::powershell4') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chef-12.11.18-universal-mingw32 | acceptance/top-cookbooks/test_run/powershell/spec/recipes/dsc_spec.rb |
chef-12.11.18 | acceptance/top-cookbooks/test_run/powershell/spec/recipes/dsc_spec.rb |