[rspec-users] How to write advanced matchers
dchelimsky at gmail.com
Mon Nov 24 22:43:53 EST 2008
On Mon, Nov 24, 2008 at 6:36 PM, Erik Pukinskis <erik at snowedin.net> wrote:
> On Fri, Nov 21, 2008 at 8:35 AM, Pat Maddox <pergesu at gmail.com> wrote:
>> "Erik Pukinskis" <erik at snowedin.net> writes:
>>> * a matcher that accepts a block and passes on some information, like has_tag?
>>> * a matcher that can go in that block and use that information, like with_tag?
>>> * a mock argument matcher like is_instance_of or hash_including?
>>> It'd be wonderful if someone could post simple examples of how you'd
>>> write custom matchers of those types
>> I hope this doesn't come across as rude...but considering that RSpec is
>> open source, you just listed a bunch of examples for yourself to check
>> out! Now all you have to do is look at the source for them.
> Hey Pat,
> Thanks for your response! Even if it's just to say RTFC. :) I have
> been digging into the source regularly. It's a bit too complicated
> for me to understand right now, and I find often the way core matchers
> are written is appropriate for code that is going to be distributed
> with RSpec, but not for code that is going to be maintained outside of
Would you mind elaborating on this? What about the way it is written
makes it appropriate to ship w/ RSpec but inappropriate for your own
> But you're right, once I understand the RSpec internals, It'll be easy
> to write matchers with a different architecture. It's just slow going
More information about the rspec-users