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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 7 Wrz, 16:05, "H. Wade Minter" <min...-VaDJcK/n3l4h9ZMKESR00Q@public.gmane.org> wrote:> 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. > > --WadeYou could simply stub current_user method to return you a valid user object (see mocha.rubyforge.org or flexmock.rubyforge.org) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sep 7, 2008, at 11:34 AM, szimek wrote:> > On 7 Wrz, 16:05, "H. Wade Minter" <min...-VaDJcK/n3l4h9ZMKESR00Q@public.gmane.org> wrote: >> 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 > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---