diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-09-07 03:45:54 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-09-07 03:45:54 +0000 |
commit | fe31f0e066ef8969366e692d21127a60a246d5a0 (patch) | |
tree | 608251106d3a893bd131519ea50b065cef49fe2f | |
parent | 68d685056a6a8a6fcb7f922c161d26a54c770213 (diff) | |
download | rails-fe31f0e066ef8969366e692d21127a60a246d5a0.tar.gz rails-fe31f0e066ef8969366e692d21127a60a246d5a0.tar.bz2 rails-fe31f0e066ef8969366e692d21127a60a246d5a0.zip |
Add a user_agent to TestRequest
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7416 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 3 | ||||
-rw-r--r-- | actionpack/test/controller/request_test.rb | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 4db8517b42..4c6c875129 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -23,7 +23,7 @@ module ActionController #:nodoc: class TestRequest < AbstractRequest #:nodoc: attr_accessor :cookies, :session_options attr_accessor :query_parameters, :request_parameters, :path, :session, :env - attr_accessor :host + attr_accessor :host, :user_agent def initialize(query_parameters = nil, request_parameters = nil, session = nil) @query_parameters = query_parameters || {} @@ -133,6 +133,7 @@ module ActionController #:nodoc: def initialize_default_values @host = "test.host" @request_uri = "/" + @user_agent = "Rails Testing" self.remote_addr = "0.0.0.0" @env["SERVER_PORT"] = 80 @env['REQUEST_METHOD'] = "GET" diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index 19ae17c171..1bb01ffd00 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -351,6 +351,10 @@ class RequestTest < Test::Unit::TestCase @request.env["CONTENT_TYPE"] = "application/xml; charset=UTF-8" assert_equal Mime::XML, @request.content_type end + + def test_user_agent + assert_not_nil @request.user_agent + end protected def set_request_method_to(method) |