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')
    users_proxy.should_receive(:find).with('1').and_return(User.new)

    @current_account.stub!(:users).and_return(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:

    @current_account.users.should_receive(:find).with('1').and_return(User.new)

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,
Matt