SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Stevenwulf's Avatar
    Join Date
    May 2002
    Location
    Berkeley
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strange error when calling follow_redirect

    Greetings, I keep getting the following error after calling follow_redirect() in one of my tests.

    Code:
      TypeError: can't convert Symbol into String
      	/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/test_process.rb:381:in `delete'
      	/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/test_process.rb:381:in `follow_redirect'
    here is my test


    Code:
       def test_show_without_platform
     	soft_name = @version.software.name.downcase
     	ver_name = @version.name.downcase
     
     	@request.env['PATH_INFO'] =  "/all/#{soft_name}/#{ver_name}"   
     	get :show, {:version => ver_name,
     						   :software => soft_name,
     						   :platform_filter => "all"}
     
     	url = user_show_software_url(:platform_filter => 'all', :software => soft_name)
     	assert_redirected_to(url)
     	
     	follow_redirect
       end
    If I comment out follow_redirect() the error does not occur. If anyone has a clue I'd love to hear from you.

  2. #2
    SitePoint Enthusiast Stevenwulf's Avatar
    Join Date
    May 2002
    Location
    Berkeley
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I think I found the problem. My redirect was taking me to a different controller. From the new "Agile Dev Book," I found the following quote:

    "follow_redirect( )
    If the preceding action generated a redirect, follow it by issuing a get
    request. Functional tests can only redirect to their own controller."

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah that would make sense I think you got it. And now I know for the future...
    Happy switcher to OS X running on a MacBook Pro.

    Zend Certified Engineer


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
  •