Forum: Ruby on Rails integration tests - 1.1

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
phil swenson (Guest)
on 2006-04-04 05:33
Iâ??m using the new 1.1 integration test facilityâ?¦ Iâ??m trying to write a
test that sees if a controller redirects to the correct place and
preserves the query string.

Hereâ??s the code:

class LoginRedirectTest < ActionController::IntegrationTest

 def test_non_admin_auth

    request_uri = "/datafeed/event/report?blah=blah"



    assert_response :success

    status = post("/login/authenticate", :login_info => {:user_name =>
"blah", :password => "blah"})


    assert_response :success

    user = session[:user]

    assert !user.nil?

#    puts response["REQUEST_URI"]

#    assert_equal(request_uri, response ["REQUEST_URI"])


The last two lines donâ??t workâ?¦ I can see REQUEST_URL in the @attributes
of the response and it contains the correct uri
("/datafeed/event/report?blah=blah"), but I canâ??t figure out how to
access it.  I also havenâ??t been able to locate the source code for the
response (CgiResponse).  Can someone point me in the right direction?


Jamis B. (Guest)
on 2006-04-04 18:34
(Received via mailing list)

Do you mean "request"? The response object doesn't encapsulate a
request_uri attribute. With the request object, you can do:


In general, the request environment can be accessed via:


(That's a Hash instance.)

Hope that helps,

This topic is locked and can not be replied to.