Skip to content

Commit bccd7ed

Browse files
committed
Merge pull request #262 from cyberious/master
Fix Solaris 10 errors in tests and more issues with Windows checks of owner
2 parents 88869c6 + 520287f commit bccd7ed

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

spec/acceptance/backup_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
describe file("#{basedir}/file") do
3535
it { should be_file }
36-
it { should contain 'new contents' }
36+
its(:content) { should match /new contents/ }
3737
end
3838
end
3939

@@ -68,11 +68,11 @@
6868

6969
describe file("#{basedir}/file") do
7070
it { should be_file }
71-
it { should contain 'new contents' }
71+
its(:content) { should match /new contents/ }
7272
end
7373
describe file("#{basedir}/file.backup") do
7474
it { should be_file }
75-
it { should contain 'old contents' }
75+
its(:content) { should match /old contents/ }
7676
end
7777
end
7878

@@ -109,7 +109,7 @@
109109

110110
describe file("#{basedir}/file") do
111111
it { should be_file }
112-
it { should contain 'new contents' }
112+
its(:content) { should match /new contents/ }
113113
end
114114
end
115115
end

spec/acceptance/specinfra_stubs.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Bas
22
class << self
33
def check_is_owned_by(file, owner)
44
Backend::PowerShell::Command.new do
5-
exec "((gci '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0"
5+
exec "if((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}'
6+
-or ((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0){ exit 0 } else { exit 1 }"
67
end
78
end
89
end

spec/acceptance/warn_spec.rb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
describe file("#{basedir}/file") do
3030
it { should be_file }
3131
its(:content) {
32-
should match '# This file is managed by Puppet. DO NOT EDIT.'
33-
should match '1'
34-
should match '2'
32+
should match /# This file is managed by Puppet\. DO NOT EDIT\./
33+
should match /1/
34+
should match /2/
3535
}
3636
end
3737
end
@@ -61,9 +61,11 @@
6161

6262
describe file("#{basedir}/file") do
6363
it { should be_file }
64-
it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' }
65-
it { should contain '1' }
66-
it { should contain '2' }
64+
its(:content) {
65+
should_not match /# This file is managed by Puppet\. DO NOT EDIT\./
66+
should match /1/
67+
should match /2/
68+
}
6769
end
6870
end
6971
context '# foo should overide default warning message' do
@@ -93,9 +95,9 @@
9395
describe file("#{basedir}/file") do
9496
it { should be_file }
9597
its(:content) {
96-
should match '# foo'
97-
should match '1'
98-
should match '2'
98+
should match /# foo/
99+
should match /1/
100+
should match /2/
99101
}
100102
end
101103
end

0 commit comments

Comments
 (0)