diff options
author | John Firebaugh <john_firebaugh@bigfix.com> | 2010-08-06 11:19:42 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-25 10:52:57 +0200 |
commit | c5093799234de248d709e0bff1a28b4d29eb658e (patch) | |
tree | aada7a5d682dd911fbefad3221172aa70c6d91a3 /actionpack/test | |
parent | 135d6164c580cbc52f8f34c38acaae1413ad0a6c (diff) | |
download | rails-c5093799234de248d709e0bff1a28b4d29eb658e.tar.gz rails-c5093799234de248d709e0bff1a28b4d29eb658e.tar.bz2 rails-c5093799234de248d709e0bff1a28b4d29eb658e.zip |
Add ActionDispatch::TestResponse tests.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/test_response_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/test_response_test.rb b/actionpack/test/dispatch/test_response_test.rb new file mode 100644 index 0000000000..dc17668def --- /dev/null +++ b/actionpack/test/dispatch/test_response_test.rb @@ -0,0 +1,21 @@ +require 'abstract_unit' + +class TestResponseTest < ActiveSupport::TestCase + def assert_response_code_range(range, predicate) + response = ActionDispatch::TestResponse.new + (0..599).each do |status| + response.status = status + assert_equal range.include?(status), response.send(predicate), + "ActionDispatch::TestResponse.new(#{status}).#{predicate}" + end + end + + test "helpers" do + assert_response_code_range 200..299, :success? + assert_response_code_range [404], :missing? + assert_response_code_range 300..399, :redirect? + assert_response_code_range 500..599, :error? + assert_response_code_range 500..599, :server_error? + assert_response_code_range 400..499, :client_error? + end +end |