|
41 | 41 | let(:logged_output) { StringIO.new }
|
42 | 42 | let(:logger) { Logger.new(logged_output) }
|
43 | 43 | let(:platform) do
|
44 |
| - instance_double(Kitchen::Platform, os_type: nil) |
| 44 | + instance_double(Kitchen::Platform, os_type: 'unix') |
45 | 45 | end
|
46 | 46 |
|
47 | 47 | let(:config) do
|
|
113 | 113 | describe '#init_command' do
|
114 | 114 | subject { provisioner.init_command }
|
115 | 115 |
|
116 |
| - it 'should give a sane command' do |
117 |
| - is_expected.to match(/mkdir/) |
| 116 | + context 'when unix' do |
| 117 | + it 'should give a sane command' do |
| 118 | + is_expected.to match(/mkdir/) |
| 119 | + end |
| 120 | + end |
| 121 | + |
| 122 | + context 'when windows' do |
| 123 | + let(:platform) do |
| 124 | + instance_double(Kitchen::Platform, os_type: 'windows') |
| 125 | + end |
| 126 | + |
| 127 | + it 'should use powershell' do |
| 128 | + is_expected.to match(/mkdir -Force -Path/) |
| 129 | + end |
118 | 130 | end
|
119 | 131 | end
|
120 | 132 |
|
|
129 | 141 | {}
|
130 | 142 | end
|
131 | 143 |
|
132 |
| - it 'should give a sane run_command' do |
133 |
| - is_expected.to match(/salt-call/) |
| 144 | + context 'when unix' do |
| 145 | + it 'should give a sane run_command' do |
| 146 | + is_expected.to match(/salt-call/) |
| 147 | + end |
| 148 | + end |
| 149 | + |
| 150 | + context 'when windows' do |
| 151 | + let(:platform) do |
| 152 | + instance_double(Kitchen::Platform, os_type: 'windows') |
| 153 | + end |
| 154 | + |
| 155 | + it 'should use salt-call.bat' do |
| 156 | + is_expected.to match(/c:\\salt\\salt-call.bat /) |
| 157 | + end |
134 | 158 | end
|
135 | 159 |
|
136 | 160 | it 'should not include extra logic to detect failures' do
|
|
194 | 218 |
|
195 | 219 | it { is_expected.to include 'https://bootstrap.saltstack.org' }
|
196 | 220 |
|
| 221 | + context "when unix" do |
| 222 | + it "should use apt-get" do |
| 223 | + expect(provisioner.install_command).to match(/apt-get/) |
| 224 | + end |
| 225 | + end |
| 226 | + |
| 227 | + context "when windows" do |
| 228 | + let(:platform) do |
| 229 | + instance_double(Kitchen::Platform, os_type: 'windows') |
| 230 | + end |
| 231 | + |
| 232 | + it "should use powershell" do |
| 233 | + expect(provisioner.install_command).to match(/powershell/) |
| 234 | + end |
| 235 | + end |
| 236 | + |
197 | 237 | context 'with salt version 2016.03.1' do
|
198 | 238 | let(:salt_version) { '2016.03.1' }
|
199 | 239 | let(:config) do
|
|
0 commit comments