Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7934

Show
Ignore:
Timestamp:
10/16/07 05:07:23 (1 year ago)
Author:
bitsweat
Message:

Improve the error message for assert_redirected_to. Closes #7337 [mikong, sandofsky]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/assertions/response_assertions.rb

    r7776 r7934  
    8080            end 
    8181 
    82             @response_diff = url[:expected].diff(url[:actual]) if url[:actual] 
    83             msg = build_message(message, "response is not a redirection to all of the options supplied (redirection is <?>), difference: <?>", 
    84                                 url[:actual], @response_diff) 
     82            @response_diff = url[:actual].diff(url[:expected]) if url[:actual] 
     83            msg = build_message(message, "expected a redirect to <?>, found one to <?>, a difference of <?> ", url[:expected], url[:actual], @response_diff) 
    8584 
    8685            assert_block(msg) do 
  • trunk/actionpack/test/controller/redirect_test.rb

    r7820 r7934  
    163163      assert_redirected_to :action => "other_host", :only_path => true 
    164164    rescue Test::Unit::AssertionFailedError => err 
    165       redirection_msg, diff_msg = err.message.scan(/<\{[^\}]+\}>/).collect { |s| s[2..-3] } 
     165      expected_msg, redirection_msg, diff_msg = err.message.scan(/<\{[^\}]+\}>/).collect { |s| s[2..-3] } 
    166166      assert_match %r("only_path"=>false),        redirection_msg 
    167167      assert_match %r("host"=>"other.test.host"), redirection_msg 
    168168      assert_match %r("action"=>"other_host"),    redirection_msg 
    169       assert_match %r("only_path"=>true),         diff_msg 
     169      assert_match %r("only_path"=>false),        diff_msg 
    170170      assert_match %r("host"=>"other.test.host"), diff_msg 
    171171    end