Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add accessors for request and response so tests don't have to mess wi…

…th internal ivars
  • Loading branch information...
commit 82514c2897a43ab58239af1fb24f8f0de2a0d989 1 parent 5f808b8
Michael Koziarski NZKoz authored
2  actionpack/lib/action_controller/test_case.rb
View
@@ -284,6 +284,8 @@ class TestCase < ActiveSupport::TestCase
include ActionDispatch::TestProcess
include ActionController::TemplateAssertions
+ attr_reader :response, :request
+
# Executes a request simulating GET HTTP method and set/volley the response
def get(action, parameters = nil, session = nil, flash = nil)
process(action, parameters, session, flash, "GET")
6 actionpack/test/controller/test_test.rb
View
@@ -189,6 +189,12 @@ def test_session_is_cleared_from_request_after_reset_session
assert_equal Hash.new, @request.session.to_hash
end
+ def test_response_and_request_have_nice_accessors
+ process :no_op
+ assert_equal @response, response
+ assert_equal @request, request
+ end
+
def test_process_with_request_uri_with_no_params
process :test_uri
assert_equal "/test_test/test/test_uri", @response.body
Please sign in to comment.
Something went wrong with that request. Please try again.