mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Improve the error message for assert_redirected_to (closes #7337) [sandofsky]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7578 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
766fbce04e
commit
9ab8d4d9ed
2 changed files with 12 additions and 3 deletions
|
@ -78,9 +78,8 @@ module ActionController
|
|||
url[key] = value
|
||||
end
|
||||
|
||||
@response_diff = url[:expected].diff(url[:actual]) if url[:actual]
|
||||
msg = build_message(message, "response is not a redirection to all of the options supplied (redirection is <?>), difference: <?>",
|
||||
url[:actual], @response_diff)
|
||||
@response_diff = url[:actual].diff(url[:expected]) if url[:actual]
|
||||
msg = build_message(message, "expected a redirect to <?>, found one to <?>, a difference of <?> ", url[:expected], url[:actual], @response_diff)
|
||||
|
||||
assert_block(msg) do
|
||||
url[:expected].keys.all? do |k|
|
||||
|
|
|
@ -109,6 +109,16 @@ class UrlHelperTest < Test::Unit::TestCase
|
|||
assert_dom_equal "<a href=\"http://www.example.com?q1=v1&q2=v2\">http://www.example.com?q1=v1&q2=v2</a>", link_to(nil, "http://www.example.com?q1=v1&q2=v2")
|
||||
end
|
||||
|
||||
def test_link_tag_with_back
|
||||
@controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {'HTTP_REFERER' => 'http://www.example.com/referer'})
|
||||
assert_dom_equal "<a href=\"http://www.example.com/referer\">go back</a>", link_to('go back', :back)
|
||||
end
|
||||
|
||||
def test_link_tag_with_back_and_no_referer
|
||||
@controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {})
|
||||
assert_dom_equal "<a href=\"javascript:history.back()\">go back</a>", link_to('go back', :back)
|
||||
end
|
||||
|
||||
def test_link_tag_with_img
|
||||
assert_dom_equal "<a href=\"http://www.example.com\"><img src='/favicon.jpg' /></a>", link_to("<img src='/favicon.jpg' />", "http://www.example.com")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue