Hi, Is it possible to test helper/view methods from script/console. I want to test the output of methods like distance_of_time_in_words. But it won''t let me from the console. What am I missing? TIA Luke -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 Feb 3, 2008, at 6:56 PM, Luke Grimstrup wrote:> > Hi, > > Is it possible to test helper/view methods from script/console. I want > to test the output of methods like distance_of_time_in_words. But it > won''t let me from the console. What am I missing? > > TIA > LukeUser the helper object: >> helper.distance_of_time_in_words 92.minutes => "about 2 hours" -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Feb-04 00:22 UTC
Re: Testing helper/view methods from script/console
On 3 Feb 2008, at 23:56, Luke Grimstrup wrote:> > Hi, > > Is it possible to test helper/view methods from script/console. I want > to test the output of methods like distance_of_time_in_words. But it > won''t let me from the console. What am I missing? >you need to include the appropriate module eg: Fs-ElephantBook:fred fred$ ruby script/console Loading development environment (Rails 2.0.2) >> require ''action_view/helpers/date_helper'' => [] >> include ActionView::Helpers::DateHelper => Object >> distance_of_time_in_words_to_now Time.mktime(2008,2,3,4) => "about 20 hours" >>>> TIA > Luke > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Feb-04 00:25 UTC
Re: Testing helper/view methods from script/console
On 4 Feb 2008, at 00:14, Rob Biedenharn wrote:> > > On Feb 3, 2008, at 6:56 PM, Luke Grimstrup wrote: > >> >> Hi, >> >> Is it possible to test helper/view methods from script/console. I >> want >> to test the output of methods like distance_of_time_in_words. But it >> won''t let me from the console. What am I missing? >> >> TIA >> Luke > > User the helper object: > >>> helper.distance_of_time_in_words 92.minutes > => "about 2 hours"Neato! I''ve somehow managed to miss that one! Fred> > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Awesome. Exactly what I was looking for. Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---