rspec/rspec-expectations — comment on commit d3e53109d36d1fef17b70e26e5b2adeeaf3aa078
File:  line 0
By pguegan:

I've recently bumped to the 2.8.0.rc2, and I noticed a kind of regression (which I think is related to this commit) in a custom matcher of mine. This match has instance variable `@date`:

```ruby
RSpec::Matchers.define :be_chronological do

match do |array|
@date ||= :created_at
array.but_first.each_with_index do |current, index|
current[@date].should > ... # Any date
end
end

def on(date)
@date = date
self
end

end
```

The problem occurs when I use this matcher in two different contexts, for instance:

```ruby
messages.should be_chronological.on(:starts_at)
...
items.should be_chronological
```

In the second call, it is supposed to use the ```:created_at```, given that no argument was provided. However, it still uses the last argument ```:starts_at``` (and thus I get a "undefined method `>' for nil:NilClass").

Is there a better way for me to solve this issue? Should matchers never have instance variables?

Thanks :)