noonat/pecs — pull request #11 by rstuven (2012-03-20 14:07:25+00:00)
Title: Added expectAssertions method

The use case is the following. Suppose the following function implements a wrong condition:

```php
function sut($value, $callback) {
if ($value < -2) // <= suppose this is wrong, it should be $value<0
call_user_func($callback, 'ok');
}
```

This test should fail:

```php
it('should be ok with any negative value', function() {
sut(-1, function($ret) {
expect($ret)->to_be('ok');
});
});
```

The test will pass because there is no way to verify all assertions were made. Now, using expectAssertions:

```php
it('should be ok with any negative value', function() {
sut(-1, function($ret) {
expect($ret)->to_be('ok');
});
expectAssertions()->to_be(1);
});
```

The test fails as expected.