Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit fe31f0e066ef8969366e692d21127a60a246d5a0 1 parent 68d6850
Michael Koziarski NZKoz authored
3  actionpack/lib/action_controller/test_process.rb
View
@@ -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"
4 actionpack/test/controller/request_test.rb
View
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.