describe file('/etc/checkfiles/server.cfg') do
its(:content) {
should contain("\/usr\/lib64\/nagios\/plugins\/check_procs -w 150 -c 200")
.after(/command\[check_total_procs\]\=/)
}
end
I'm using contain matcher like this code, but it will be obsoleted. There is so many lines in 'server.cfg' and I want to check only 1line. How can I make same working code without contain matcher?
The docs note that:
I am inclined to say that this change may not have been properly thought out by the maintainer, and you might suggest to him that this feature should not in fact be deprecated.
With that said, though, it is easy enough to solve this problem just using regex:
The key insight there being use of multiline regex
//m, allowing you to say that one string comes after another in the file.