GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/ddollar/rails.git
Fix assert_redirected_to so it works with symbols


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4004 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
jamis (author)
Mon Mar 20 10:16:48 -0800 2006
commit  b0189f3f2ffd9de95ba2332cdcfaf48d28081e18
tree    e2983d4778346001f262b19fe2932ed1fce2bf5e
parent  49414750693a61ad078549b9edb5260f32f69561
...
85
86
87
88
89
 
 
90
91
92
...
85
86
87
 
 
88
89
90
91
92
0
@@ -85,8 +85,8 @@ module Test #:nodoc:
0
             assert_equal(eurl, url, msg) if eurl && url
0
             assert_equal(epath, path, msg) if epath && path
0
           else
0
- @response_diff = options.diff(@response.redirected_to) if @response.redirected_to
0
- msg = build_message(message, "response is not a redirection to all of the options supplied (redirection is <?>), difference: <?>",
0
+ @response_diff = options.diff(@response.redirected_to) if options.is_a?(Hash) && @response.redirected_to.is_a?(Hash)
0
+ msg = build_message(message, "response is not a redirection to all of the options supplied (redirection is <?>)#{', difference: <?>' if @response_diff}",
0
                                 @response.redirected_to || @response.redirect_url, @response_diff)
0
 
0
             assert_block(msg) do
...
7
8
9
10
 
11
12
13
...
54
55
56
57
58
 
 
59
 
 
 
 
 
 
 
 
 
 
60
61
62
...
393
394
395
 
 
 
 
 
396
...
7
8
9
 
10
11
12
13
...
54
55
56
 
 
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
...
403
404
405
406
407
408
409
410
411
0
@@ -7,7 +7,7 @@ class TestTest < Test::Unit::TestCase
0
       flash["test"] = ">#{flash["test"]}<"
0
       render :text => 'ignore me'
0
     end
0
-
0
+
0
     def render_raw_post
0
       raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank?
0
       render :text => request.raw_post
0
@@ -54,9 +54,19 @@ HTML
0
       render :text => params[:file].size
0
     end
0
 
0
- def rescue_action(e)
0
- raise e
0
+ def redirect_to_symbol
0
+ redirect_to :generate_url, :id => 5
0
     end
0
+
0
+ private
0
+
0
+ def rescue_action(e)
0
+ raise e
0
+ end
0
+
0
+ def generate_url(opts)
0
+ url_for(opts.merge(:action => "test_uri"))
0
+ end
0
   end
0
 
0
   def setup
0
@@ -393,4 +403,9 @@ HTML
0
   def test_test_uploaded_file_exception_when_file_doesnt_exist
0
     assert_raise(RuntimeError) { ActionController::TestUploadedFile.new('non_existent_file') }
0
   end
0
+
0
+ def test_assert_redirected_to_symbol
0
+ get :redirect_to_symbol
0
+ assert_redirected_to :generate_url
0
+ end
0
 end

Comments

    No one has commented yet.