Forum: Ruby on Rails integration tests - 1.1

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1ed4bbef573bfc014d32356d53103ca2?d=identicon&s=25 phil swenson (Guest)
on 2006-04-04 03: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"

    get(request_uri)

    follow_redirect!

    assert_response :success

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

    follow_redirect!

    assert_response :success

    user = session[:user]

    assert !user.nil?

#    puts response["REQUEST_URI"]

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

end



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?



Thanks,

phil
992fe8c19bbbc27f2b562a9f96efc03d?d=identicon&s=25 Jamis Buck (Guest)
on 2006-04-04 16:34
(Received via mailing list)
Phil,

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

   request.request_uri

In general, the request environment can be accessed via:

   request.env

(That's a Hash instance.)

Hope that helps,

Jamis
This topic is locked and can not be replied to.