phpspec/phpspec2 — pull request #112 by phuedx (2013-02-28 12:51:27+00:00)
Title: Add a "shouldMatch" matcher.

# Motivation

I'm currently writing the specification for an object that constructs internal URIs based on a few, possibly, sluggified strings. Among other things, I'd like to be able to assert that the URIs that the object produces conform to a certain pattern. Hence, the `shouldMatch` matcher.

## Example step
```php
public function it_should_produce_a_uri_that_conforms_to_the_internal_standard()
{
$this->generate('value1', 'value2')->shouldMatch('/company:entity:[a-z0-9]+$/');
}
```

# Additional notes

You'll see from the associated commits that I originally called this matcher `StringMatcher`. This is because I toyed with including `shouldStartWith`, `shouldEndWith`, and `shouldContain` (which, unfortunately, is a type ambiguous name) matchers. Since it's the responsibility of the matcher to test whether or not the value matches a pattern, I renamed it to `PatternMatcher`.

It can easily be renamed back to the more generic `StringMatcher` if and when those additional matchers are required.