rspec/rspec-expectations — pull request #295 by yujinakayama (2013-07-22 17:13:25+00:00)
Title: Support do..end style block with raise_error matcher

Currently `raise_error` matcher accepts only `{..}` style blocks, because `{..}` blocks have higher precedence over `do..end` blocks. This is a common pitfall.

```ruby
expect { do_something }.to raise_error do |error|
expect(error.some_value).to eq(1)
end
```

In this case, the `do..end` block is taken by the `#to` method and the `#raise_error` gets no block.

This patch makes `raise_error` matcher to use the block passed as an argument from `#to` if it did not take any block directly.