SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    NC
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    undefined method `render' thrown in helper tet

    Hello,

    I'm trying to write a very simple test for a very simple method in a helper_test.

    Here's the method I'm testing in my_helper.rb:

    Code:
      def subscribe_email_link
        if @subscription_model_class
          render(:partial => '/subscription/toggle')
        end
      end
    And in my_helper_test.rb

    I'm trying:

    Code:
      def test_subscribe_email_link    
        @subscription_model_class = true
        link = subscribe_email_link  
      end
    The link = subscribe_email_link section throws a "undefined method `render' " error

    Is there a way I can add render functionality in this helper test?

    Thanks for your time.

  2. #2
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is probably because your helper is supposed to be called in controller instance scope of template scope. try shoving 'include MyHelper' in clas scope of your Test to make the helper's method visible in test scope. I think that will do the trick
    http://virtualfunction.net - Rails Web Development
    http://squaremove.co.uk - Rails powered Property Listings


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •