Allow custom matchers to use built-in #match #194

Merged
merged 3 commits into from Dec 7, 2012

Projects

None yet

3 participants

@stevenharman

See Issue #188.

stevenharman added some commits Dec 6, 2012
@stevenharman stevenharman Cleanup whitespace b36e3ca
@stevenharman stevenharman Allow custom matchers to use #match built in
Addresses problem with dispatching the #match matcher from within a
custom matcher. (Wow... what a mouthful) See Issue #188.
6442118
@myronmarston
RSpec member

Nice work! This looks like an appropriate fix.

I think it could benefit from some docs explaining the reason match_regex exists (e.g. as a work around when you're in a context that has another match method). Can you add that?

@stevenharman

Thanks.

I was thinking some explanation was due as well, but I'm not quite sure where to put it. Suggestions?

@myronmarston
RSpec member

Maybe here and in the cuke you modified?

@stevenharman

OK, I'll add some docs tomorrow - Big Nerd Ranch holiday party starts 🔜

@alindeman

This looks good to me now.

@myronmarston myronmarston merged commit 7fe9ec4 into rspec:master Dec 7, 2012

1 check passed

Details default The Travis build passed
@myronmarston
RSpec member

Thanks, @stevenharman!

@eloyesp eloyesp pushed a commit to eloyesp/rspec-expectations that referenced this pull request Nov 5, 2013
@myronmarston myronmarston Rewrite custom matcher DSL.
Rather than evaling the `define` block in the
context of the matcher instance, eval the `define`
block in the context of the matcher instance's
singleton class.

* Fixes rspec#272.
  `include` in `define` has a different meaning (module inclusion)
  than `include` in the `match` block (using the `include` matcher to
  match).
* Better solution than rspec#194
  for rspec#188. There's now
  a `match` class method and a `match` instance method.
* Completely avoids issues we had to use hacks to solve before:
  rspec#29,
  rspec#38,
  rspec@fc4b66d
ec0094c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment