File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed
Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 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
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
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
115115end
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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
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
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
You can’t perform that action at this time.
0 commit comments