/* steve jansen */

// another day in paradise hacking code and more

Regexes for the Serverspec 2 Update

| Comments

The Serverspec team just released v2 of their outstanding testing library today, after a very long beta period. The v2 release had a few breaking breaking changes due to dropped rspec matchers that had been deprecated.

If your test-kitchen tests recently broke today, here’s a few regexes I used with Sublime Text’s regex find/replace to rewrite the dropped matchers for the new matchers.

1
2
3
4
5
6
7
8
9
10
11
it\s*\{\s*(should|should_not)\s*return_(stdout|stderr)\s*\(?(\/.*\/)\)?\s*\}
its(:\2) { \1 match \3 }

it\s*\{\s*(should|should_not)\s*return_(stdout|stderr)\s*\(?(\".*\")\)?\s*\}
its(:\2) { \1 contain \3 }

it\s*\{\s*(should|should_not)\s*return_(stdout|stderr)\s*\(?('.*')\)?\s*\}
its(:\2) { \1 contain \3 }

it\s*\{\s*(should|should_not)\s*return_exit_status\s*(\d+)\s*\}
its(:exit_status) { \1 eq \2 }

Hopefully the kitchen busser project will one day add support for Gemfile-style constraints on the test node, since busser always installs the latest version of a busser plugin gem today..

Comments