Permalink
Browse files

Add a user_agent to TestRequest

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7416 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 68d6850 commit fe31f0e066ef8969366e692d21127a60a246d5a0 @NZKoz NZKoz committed Sep 7, 2007
Showing with 6 additions and 1 deletion.
  1. +2 −1 actionpack/lib/action_controller/test_process.rb
  2. +4 −0 actionpack/test/controller/request_test.rb
@@ -23,7 +23,7 @@ def process_with_test(*args)
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 @@ def initialize_containers
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"
@@ -351,6 +351,10 @@ def test_content_type_with_charset
@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)

0 comments on commit fe31f0e

Please sign in to comment.