Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Sticky matcher chain methods #109

laserlemon opened this Issue Jan 22, 2012 · 2 comments


None yet
2 participants

This is an example from the rspec-expectations source:

RSpec::Matchers.define :have_errors_on do |key|
  chain :with do |message|
    @message = message

  match do |actual|
    actual.errors[key] == @message

The problem is that if this matcher is used twice, the @message seems to stick around from the first invocation. Is there a way to avoid that and make sure the chained attributes are cleared out between uses?


dchelimsky commented Jan 22, 2012

Already reported and fixed (will be released soon): #104

@dchelimsky dchelimsky closed this Jan 22, 2012

Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment