shpec/shpec — pull request #17 by locochris (2013-02-14 06:37:31+00:00)
Title: Add support for custom matchers

eg.

#### process.sh
``` sh
have_process_count() {
pattern=`echo $1 | sed 's/\(.\)/[\1]/'`
expected_count=$2
process_list=`ps waux|grep "[0-9][0-9] $pattern"`
echo "$process_list" |
sed 's/^/ /g' |
sed 's/[ ]*$//g' # for ?some? reason unicorn jobs have a bunch of ugly trailing whitespace
process_count=`[[ -z $process_list ]] && echo 0 || echo "$process_list"|wc -l`
assert equal $process_count $expected_count
}
```

#### unicorn.sh
``` sh
#!/usr/bin/env shpec
. process.sh

describe "unicorn_rails worker"
it
should have_process_count 8
end_describe
```