Skip to content

Commit

Permalink
Fix Solaris 10 errors in tests and more issues with Windows checks of…
Browse files Browse the repository at this point in the history
… owner
  • Loading branch information
Travis Fields committed Feb 11, 2015
1 parent 88869c6 commit 520287f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
8 changes: 4 additions & 4 deletions spec/acceptance/backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'new contents' }
its(:content) { should match /new contents/ }
end
end

Expand Down Expand Up @@ -68,11 +68,11 @@

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

Expand Down Expand Up @@ -109,7 +109,7 @@

describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'new contents' }
its(:content) { should match /new contents/ }
end
end
end
3 changes: 2 additions & 1 deletion spec/acceptance/specinfra_stubs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 11 additions & 9 deletions spec/acceptance/warn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
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
Expand Down Expand Up @@ -61,9 +61,11 @@

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
Expand Down Expand Up @@ -93,9 +95,9 @@
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
Expand Down

0 comments on commit 520287f

Please sign in to comment.