Problem finding method while testing a helper

I’m trying to test the code in my helpers, using the great Viget Labs
helper_me_test plugin. However, I’m running into an oddity (unrelated
to the plugin - it was happening when I was trying to roll my own
solution as well).

Here are snippets of the relevant code:

http://pastie.org/private/5yop8zcceszxqfzedhata

Basically, the ApplicationController defines a current_user method,
that returns a RackLdap object.

The helper I’m testing is calling that method.

This works fine when the app is running. But when I try to test, it
seems like it’s trying to call ApplicationHelperTest::current_user
instead of ApplicationController::current_user, and dying.

Any suggestions on how I can get past this? I’ve been staring at it
for a couple of days and am stumped.

–Wade

On 7 Wrz, 16:05, “H. Wade M.” [email protected] wrote:

that returns a RackLdap object.
–Wade
You could simply stub current_user method to return you a valid user
object (see mocha.rubyforge.org or flexmock.rubyforge.org)

On Sep 7, 2008, at 11:34 AM, szimek wrote:

http://pastie.org/private/5yop8zcceszxqfzedhata
Any suggestions on how I can get past this? I’ve been staring at it
for a couple of days and am stumped.

–Wade

You could simply stub current_user method to return you a valid user
object (see mocha.rubyforge.org or flexmock.rubyforge.org)

Would I stub ApplicationHelperTest::current_user?

Thanks,
Wade

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs