diff options
author | Jamis Buck <jamis@37signals.com> | 2005-07-31 10:31:47 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-07-31 10:31:47 +0000 |
commit | 020ed6fa1fa5f73e5af88e3c9cdff09293e76789 (patch) | |
tree | d680b898062e417fe448cd43e4a2ce076aaaa298 /actionpack/test/controller/test_test.rb | |
parent | b4c34f7b2b18720381b3c8cfa79f66a530b3ed0b (diff) | |
download | rails-020ed6fa1fa5f73e5af88e3c9cdff09293e76789.tar.gz rails-020ed6fa1fa5f73e5af88e3c9cdff09293e76789.tar.bz2 rails-020ed6fa1fa5f73e5af88e3c9cdff09293e76789.zip |
Allow remote_addr to be queried on TestRequest #1668
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1960 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/test_test.rb')
-rw-r--r-- | actionpack/test/controller/test_test.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index b27f3e9423..570f92e6e4 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -37,7 +37,11 @@ HTML end def test_only_one_param - render :text => (@params[:left] && @params[:right]) ? "EEP, Both here!" : "OK" + render :text => (params[:left] && params[:right]) ? "EEP, Both here!" : "OK" + end + + def test_remote_addr + render :text => (request.remote_addr || "not specified") end end @@ -164,4 +168,13 @@ HTML assert ActionController::Routing::Routes assert_equal routes_id, ActionController::Routing::Routes.object_id end + + def test_remote_addr + get :test_remote_addr + assert_equal "0.0.0.0", @response.body + + @request.remote_addr = "192.0.0.1" + get :test_remote_addr + assert_equal "192.0.0.1", @response.body + end end |