diff options
author | Lance Ivy <lance@cainlevy.net> | 2008-11-22 13:10:12 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-11-22 13:10:12 -0600 |
commit | cd1a9ed991e8988dbcc28023b91e76b5ee45f79b (patch) | |
tree | b1e10b7d6b66edbd9c395c28ca328be02569a712 /actionpack/lib/action_controller | |
parent | f42c77f927eb49b00e84d355e07de48723d03fcb (diff) | |
download | rails-cd1a9ed991e8988dbcc28023b91e76b5ee45f79b.tar.gz rails-cd1a9ed991e8988dbcc28023b91e76b5ee45f79b.tar.bz2 rails-cd1a9ed991e8988dbcc28023b91e76b5ee45f79b.zip |
Add TestResponse#client_error? to check for 4xx status codes [#851 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 3aceb20814..cd3914f011 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -200,6 +200,11 @@ module ActionController #:nodoc: alias_method :server_error?, :error? + # Was there a client client? + def client_error? + (400..499).include?(response_code) + end + # Returns the redirection location or nil def redirect_url headers['Location'] @@ -283,7 +288,7 @@ module ActionController #:nodoc: # See AbstractResponse for more information on controller response objects. class TestResponse < AbstractResponse include TestResponseBehavior - + def recycle! headers.delete('ETag') headers.delete('Last-Modified') |