Topic: How to make proxy object more transparent?

Hi all,

I have some code like this in my controller:

   @user = current_account.users.find(params[:id])

At the moment when testing using rspec, im doing this:

    users_proxy = mock('users proxy')


@current_account is a mock that i've setup in a helper method as thats needed all the time, the problem is I find that too messy - someone suggested to me to try this:


Which would be perfect, and make all of my specs a lot more simple - but unfortunately that doesn't work.

Can anyone point me in the right direction here? Am I doing it the right way? Is there a cleaner quicker way to do it like the last code example?

Thanks in advance,