[rspec-users] Problems with testing nested routes using mocking

Jarkko Laine jarkko at jlaine.net
Mon Oct 1 12:26:36 EDT 2007

On 1.10.2007, at 18.25, Jesper Laursen wrote:
> Okay, now it seems til work.
> The problem has what I have to place:
>      @domain.virtual_hosts.should_receive(:find).with 
> ("1").and_return(@virtual_host)
> in the before, because the  "do_get" method was using it, in all it- 
> blocks.
> I just think that my before are pretty big.
> And I have to copy it for every describtion.

You could wrap it in a helper method in a module that you can include  
and call in the specs instead of repeating all the lines.


Jarkko Laine

More information about the rspec-users mailing list