diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-28 23:25:00 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-28 23:25:00 +0000 |
commit | 13e1d295d69d6410e0e4350aff8dde0e5151717d (patch) | |
tree | be9d91e3c674172dcdb447679d6a22e57507d386 /actionpack/test | |
parent | f6e85e4ec68d677a90986b47f71ac762fc19c3f7 (diff) | |
download | rails-13e1d295d69d6410e0e4350aff8dde0e5151717d.tar.gz rails-13e1d295d69d6410e0e4350aff8dde0e5151717d.tar.bz2 rails-13e1d295d69d6410e0e4350aff8dde0e5151717d.zip |
@response.redirect_url works with 201 Created responses: just return headers['Location'] rather than checking the response status.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5643 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/test_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index ee172b25a4..bc2651c281 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -66,6 +66,11 @@ HTML redirect_to :controller => 'fail', :id => 5 end + def create + headers['Location'] = 'created resource' + head :created + end + private def rescue_action(e) raise e @@ -463,6 +468,20 @@ HTML end end + def test_redirect_url_only_cares_about_location_header + get :create + assert_response :created + + # Redirect url doesn't care that it wasn't a :redirect response. + assert_equal 'created resource', @response.redirect_url + assert_equal @response.redirect_url, redirect_to_url + + # Must be a :redirect response. + assert_raise(Test::Unit::AssertionFailedError) do + assert_redirected_to 'created resource' + end + end + protected def with_foo_routing with_routing do |set| |