diff options
author | Michael Koziarski <michael@koziarski.com> | 2010-04-09 11:28:19 +1200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2010-04-09 11:30:39 +1200 |
commit | 82514c2897a43ab58239af1fb24f8f0de2a0d989 (patch) | |
tree | ee0f76d8565a98eae7d31461b5ce902ff441e228 | |
parent | 5f808b865cc0bbb10af7733cc0c4da3add572a95 (diff) | |
download | rails-82514c2897a43ab58239af1fb24f8f0de2a0d989.tar.gz rails-82514c2897a43ab58239af1fb24f8f0de2a0d989.tar.bz2 rails-82514c2897a43ab58239af1fb24f8f0de2a0d989.zip |
Add accessors for request and response so tests don't have to mess with internal ivars
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/test_test.rb | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 2d4cf2fafb..dfd8e75bcc 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -284,6 +284,8 @@ module ActionController 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") diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 8910454b8b..6f1ce2fef7 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -189,6 +189,12 @@ XML 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 |