Fix Solaris 10 errors in tests and more issues with Windows checks of owner
This commit is contained in:
parent
88869c6aed
commit
520287fd05
3 changed files with 17 additions and 14 deletions
|
@ -33,7 +33,7 @@ describe 'concat backup parameter' do
|
||||||
|
|
||||||
describe file("#{basedir}/file") do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'new contents' }
|
its(:content) { should match /new contents/ }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,11 +68,11 @@ describe 'concat backup parameter' do
|
||||||
|
|
||||||
describe file("#{basedir}/file") do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'new contents' }
|
its(:content) { should match /new contents/ }
|
||||||
end
|
end
|
||||||
describe file("#{basedir}/file.backup") do
|
describe file("#{basedir}/file.backup") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'old contents' }
|
its(:content) { should match /old contents/ }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ describe 'concat backup parameter' do
|
||||||
|
|
||||||
describe file("#{basedir}/file") do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should contain 'new contents' }
|
its(:content) { should match /new contents/ }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,8 @@ class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Bas
|
||||||
class << self
|
class << self
|
||||||
def check_is_owned_by(file, owner)
|
def check_is_owned_by(file, owner)
|
||||||
Backend::PowerShell::Command.new do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,9 +29,9 @@ describe 'concat warn =>' do
|
||||||
describe file("#{basedir}/file") do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
its(:content) {
|
its(:content) {
|
||||||
should match '# This file is managed by Puppet. DO NOT EDIT.'
|
should match /# This file is managed by Puppet\. DO NOT EDIT\./
|
||||||
should match '1'
|
should match /1/
|
||||||
should match '2'
|
should match /2/
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -61,9 +61,11 @@ describe 'concat warn =>' do
|
||||||
|
|
||||||
describe file("#{basedir}/file") do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' }
|
its(:content) {
|
||||||
it { should contain '1' }
|
should_not match /# This file is managed by Puppet\. DO NOT EDIT\./
|
||||||
it { should contain '2' }
|
should match /1/
|
||||||
|
should match /2/
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context '# foo should overide default warning message' do
|
context '# foo should overide default warning message' do
|
||||||
|
@ -93,9 +95,9 @@ describe 'concat warn =>' do
|
||||||
describe file("#{basedir}/file") do
|
describe file("#{basedir}/file") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
its(:content) {
|
its(:content) {
|
||||||
should match '# foo'
|
should match /# foo/
|
||||||
should match '1'
|
should match /1/
|
||||||
should match '2'
|
should match /2/
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue