[rspec-users] Something cool I learned about rspec today

aslak hellesoy aslak.hellesoy at gmail.com
Fri Jan 19 05:44:57 EST 2007


On 1/19/07, Ashley Moran <work at ashleymoran.me.uk> wrote:
>
> On 19 Jan 2007, at 10:05, Pat Maddox wrote:
>
> > I found an awesome feature today.  When you're setting expectations,
> > you can actually pattern match the parameters to methods.  Here's my
> > discussion and example:
> > http://evang.eli.st/blog/2007/1/19/parameter-matching-in-rspec
>
> Just out of curiosity, what would happen if you needed to pass a
> regex as a message argument?
>

Your mock expectation would look the same, and you'd have to call the
method with an eql regexp to make it pass. -Like the example in the
docs illustrates.

Aslak

> Ashley
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list