rodjek/rspec-puppet — pull request #106 by rodjek (2013-05-19 04:49:33+00:00)
Title: New relationship matchers

This branch adds new chain methods to the `contain_` matcher that examines the graph edges in the catalogue to determine resource relationship.

```ruby
it { should contain_whatever('foo').that_notifies('Whatever[bar]') }
it { should contain_whatever('foo').that_subscribes_to('Whatever[bar]') }
it { should contain_whatever('foo').that_requires('Whatever[bar]') }
it { should contain_whatever('foo').that_comes_before('Whatever[bar]') }
```

Regardless of if the relationship is defined with metaparams or chaining, these chains will match them. They will also match the reverse of the defined relationship, so if you have a resource with a `before` relationship

```puppet
notify { 'foo': }
notify { 'bar':
before => Notify['foo'],
}
```

You can match that `Notify[bar]` comes before `Notify[foo]`
```ruby
it { should contain_notify('bar').that_comes_before('Notify[foo]') }
```

Or, you can test that `Notify[foo]` requires `Notify[bar']`
```ruby
it { should contain_notify('foo').that_requires('Notify[bar]') }
```