[rspec-users] How to write advanced matchers

Erik Pukinskis erik at snowedin.net
Mon Nov 24 19:36:45 EST 2008


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
RSpec.

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
sometimes.

best,

Erik


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.
>
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list