On 7 Jun 2010, at 16:52, Ben Butler-Cole wrote: > On 7 June 2010 16:34, Matt Wynne <m...@mattwynne.net> wrote: > > I'm still not quite clear what you're trying to achieve. Do you want to > assert that a specific block is passed to the collaborator, or do you want to > assert that any old block with a particular behaviour is passed to the > collaborator? > > If it's the former, you can test it by creating a test double for the block, > and asserting that it's passed to the collaborator > > The later. The block gets created by the code under test, so I can't create a > double for it.
Aha OK. I don't know how to do that using RSpec's mocking framework. I'd probably just build my own test double for the collaborator, giving it some simple behaviour to test the block. Something like this: http://gist.github.com/428867 There might be a way to do this using custom matchers[1] but I don't know how to do it myself. Hopefully someone else will chime in if there is. cheers, Matt [1]http://wiki.github.com/dchelimsky/rspec/custom-matchers > -Ben > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users