Sha256: 966d0373cab35ef13f703c834eb1d82e82a59fb13d54116a96b0667fe71045d6

Contents?: true

Size: 1.37 KB

Versions: 71

Compression:

Stored size: 1.37 KB

Contents

shared_examples "a powershell command runner" do
  describe 'configurations are not set' do
    context file('/some/file') do
      it { should be_file }
      its(:command) { should == "((Get-Item -Path '/some/file' -Force).attributes.ToString() -Split ', ') -contains 'Archive'" }
    end
  end

  describe 'path is set' do
    let(:path) { 'c:/path/bin' }
    context file('/some/file') do
      it { should be_file }
      its(:command) { 
        should == <<-eof
$env:path = "c:/path/bin;$env:path"
((Get-Item -Path '/some/file' -Force).attributes.ToString() -Split ', ') -contains 'Archive'
eof
      }
    end
  end

  describe 'pre_command is set' do
    let(:pre_command) { 'some_other_command' }
    context file('/some/file') do
      it { should be_file }
      its(:command) { should == <<-eof
if (some_other_command)
{
((Get-Item -Path '/some/file' -Force).attributes.ToString() -Split ', ') -contains 'Archive'
}
eof
      }
    end
  end

  describe 'path and pre_command are set' do
    let(:path) { 'c:/path/bin' }
    let(:pre_command) { 'some_other_command' }
    context file('/some/file') do
      it { should be_file }
      its(:command) { should == <<-eof
$env:path = "c:/path/bin;$env:path"
if (some_other_command)
{
$env:path = "c:/path/bin;$env:path"
((Get-Item -Path '/some/file' -Force).attributes.ToString() -Split ', ') -contains 'Archive'
}
eof
      }
    end
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
serverspec-0.10.1 spec/support/powershell_command_runner.rb
serverspec-0.10.0 spec/support/powershell_command_runner.rb
serverspec-0.9.8 spec/support/powershell_command_runner.rb
serverspec-0.9.7 spec/support/powershell_command_runner.rb
serverspec-0.9.6 spec/support/powershell_command_runner.rb
serverspec-0.9.5 spec/support/powershell_command_runner.rb
serverspec-0.9.4 spec/support/powershell_command_runner.rb
serverspec-0.9.3 spec/support/powershell_command_runner.rb
serverspec-0.9.2 spec/support/powershell_command_runner.rb
serverspec-0.9.1 spec/support/powershell_command_runner.rb
serverspec-0.9.0 spec/support/powershell_command_runner.rb