From 891a962a192bdd7eb0402b41e11a5e5657fe961c Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Sun, 19 Mar 2006 03:50:14 +0000 Subject: Added nicer message for assert_redirected_to (closes #4294) [court3nay, Chris McGrath] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3969 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/redirect_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb index 11b32d356b..d9b9042d5a 100755 --- a/actionpack/test/controller/redirect_test.rb +++ b/actionpack/test/controller/redirect_test.rb @@ -58,6 +58,20 @@ class RedirectTest < Test::Unit::TestCase assert_redirected_to :action => "other_host", :only_path => false, :host => 'other.test.host' end + def test_redirect_error_with_pretty_diff + get :host_redirect + begin + assert_redirected_to :action => "other_host", :only_path => true + rescue Test::Unit::AssertionFailedError => err + redirection_msg, diff_msg = err.message.scan(/<\{[^\}]+\}>/).collect { |s| s[2..-3] } + assert_match %r(:only_path=>false), redirection_msg + assert_match %r(:host=>"other.test.host"), redirection_msg + assert_match %r(:action=>"other_host"), redirection_msg + assert_match %r(:only_path=>true), diff_msg + assert_match %r(:host=>"other.test.host"), diff_msg + end + end + def test_module_redirect get :module_redirect assert_redirect_url "http://test.host/module_test/module_redirect/hello_world" -- cgit v1.2.3