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 Pat
Ashley Moran
2007-Jan-19 10:37 UTC
[rspec-users] Something cool I learned about rspec today
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-rspecJust out of curiosity, what would happen if you needed to pass a regex as a message argument? Ashley
aslak hellesoy
2007-Jan-19 10:39 UTC
[rspec-users] Something cool I learned about rspec today
On 1/19/07, Pat Maddox <pergesu at gmail.com> 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 >Nice writeup Pat!> Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aslak hellesoy
2007-Jan-19 10:44 UTC
[rspec-users] Something cool I learned about rspec today
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 >