Merge pull request #262 from cyberious/master

Fix Solaris 10 errors in tests and more issues with Windows checks of owner
This commit is contained in:
Hunter Haugen 2015-02-11 05:30:14 -08:00
commit bccd7ed992
3 changed files with 17 additions and 14 deletions

View file

@ -33,7 +33,7 @@ describe 'concat backup parameter' do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'new contents' }
its(:content) { should match /new contents/ }
end
end
@ -68,11 +68,11 @@ describe 'concat backup parameter' do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'new contents' }
its(:content) { should match /new contents/ }
end
describe file("#{basedir}/file.backup") do
it { should be_file }
it { should contain 'old contents' }
its(:content) { should match /old contents/ }
end
end
@ -109,7 +109,7 @@ describe 'concat backup parameter' do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'new contents' }
its(:content) { should match /new contents/ }
end
end
end

View file

@ -2,7 +2,8 @@ class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Bas
class << self
def check_is_owned_by(file, owner)
Backend::PowerShell::Command.new do
exec "((gci '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0"
exec "if((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}'
-or ((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0){ exit 0 } else { exit 1 }"
end
end
end

View file

@ -29,9 +29,9 @@ describe 'concat warn =>' do
describe file("#{basedir}/file") do
it { should be_file }
its(:content) {
should match '# This file is managed by Puppet. DO NOT EDIT.'
should match '1'
should match '2'
should match /# This file is managed by Puppet\. DO NOT EDIT\./
should match /1/
should match /2/
}
end
end
@ -61,9 +61,11 @@ describe 'concat warn =>' do
describe file("#{basedir}/file") do
it { should be_file }
it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' }
it { should contain '1' }
it { should contain '2' }
its(:content) {
should_not match /# This file is managed by Puppet\. DO NOT EDIT\./
should match /1/
should match /2/
}
end
end
context '# foo should overide default warning message' do
@ -93,9 +95,9 @@ describe 'concat warn =>' do
describe file("#{basedir}/file") do
it { should be_file }
its(:content) {
should match '# foo'
should match '1'
should match '2'
should match /# foo/
should match /1/
should match /2/
}
end
end