rspec/rspec-expectations — Issue #112: Stubbing with custom matchers is broken
Author: dchelimsky
Created: 2012-01-24 12:22:57+00:00
State: open

Originally reported by @aslakhellesoy: rspec/rspec-mocks#97:

I tried to upgrade gherkin's specs from 2.7.0 to 2.8.0, and that broke a bunch of specs. I have isolated it to this:

```ruby
RSpec::Matchers.define :r do |expected|
match do |row|
def row.inspect
"r " + self.map{|cell| cell}.inspect
end
row.map{|cell| cell}.should == expected
end
end

describe 'Stubbing with custom matcher' do
it 'works with 2.7.0 but not with 2.8.0' do
x = Object.new
x.should_receive(:row).with(r(['1', '']), 1)
x.should_receive(:row).with(r(['', '4']), 2)

x.row(['1', ''], 1)
x.row(['', '4'], 2)
end
end
```

I haven't seen anything in the changelog about changing APIs, so I assume this is a regression?