On Sat, Feb 7, 2009 at 3:47 AM, rgagnon <rem.gag...@gmail.com> wrote:
> I have this and I want to mock the to_xml but not his block cause this
> is what I want to spec.  Is there a way to do this?

Use and_yield to yield an object, and you can set expectations on it.
For example:

xml_detent = mock('xml detenteur')
xml_detent.stub!(:intervenant_adresses).and_return(array_of_addresses)
detenteur.stub!(:to_xml).and_yield(xml_detent)

Does that make sense?

Pat
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to