From 520287fd0546f96d58722c014c44bfa42d853e6a Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Tue, 10 Feb 2015 22:36:14 -0800 Subject: [PATCH] Fix Solaris 10 errors in tests and more issues with Windows checks of owner --- spec/acceptance/backup_spec.rb | 8 ++++---- spec/acceptance/specinfra_stubs.rb | 3 ++- spec/acceptance/warn_spec.rb | 20 +++++++++++--------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/spec/acceptance/backup_spec.rb b/spec/acceptance/backup_spec.rb index 1989f44..1d3a5df 100644 --- a/spec/acceptance/backup_spec.rb +++ b/spec/acceptance/backup_spec.rb @@ -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 diff --git a/spec/acceptance/specinfra_stubs.rb b/spec/acceptance/specinfra_stubs.rb index d42e1c0..bae85ef 100644 --- a/spec/acceptance/specinfra_stubs.rb +++ b/spec/acceptance/specinfra_stubs.rb @@ -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 diff --git a/spec/acceptance/warn_spec.rb b/spec/acceptance/warn_spec.rb index 7101f61..2788607 100644 --- a/spec/acceptance/warn_spec.rb +++ b/spec/acceptance/warn_spec.rb @@ -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