mizzy/serverspec — pull request #32 by gongo (2013-04-03 13:19:33+00:00)
Title: Add chain from() and to() to contain mathcer

Support checking `contain()` matcher within the range specified in the file

e.g.

```sh
$ cat Gemfile

group :test do
gem 'rspec'
end

group :doc do
gem 'rdoc'
end
```

```ruby
describe 'Gemfile' do
it { should be_file }

# check contain this file
it { should contain 'rspec' }
it { should contain 'rdoc' }

# check contain ahead of 'group :test do ; end'
it { should_not contain('rspec').to(/^group :test do/) }
it { should_not contain('rdoc').to(/^group :test do/) }

# check contain behind 'group :test do ; end'
it { should contain('rspec').from(/^group :test do/) }
it { should contain('rdoc').from(/^group :test do/) }

# check contain within 'group :test do ; end'
it { should contain('rspec').from(/^group :test do/).to(/^end/) }
it { should_not contain('rdoc').from(/^group :test do/).to(/^end/) }

# check contain within 'group :doc do ; end'
it { should_not contain('rspec').from(/^group :doc do/).to(/^end/) }
it { should contain('rdoc').from(/^group :doc do/).to(/^end/) }
end
```