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

Changeset 7933

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

Test link_to 'back', :back

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/test/template/url_helper_test.rb

    r7791 r7933  
    108108  def test_link_tag_with_query_and_no_name 
    109109    assert_dom_equal "<a href=\"http://www.example.com?q1=v1&amp;q2=v2\">http://www.example.com?q1=v1&amp;q2=v2</a>", link_to(nil, "http://www.example.com?q1=v1&amp;q2=v2") 
     110  end 
     111 
     112  def test_link_tag_with_back 
     113    @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {'HTTP_REFERER' => 'http://www.example.com/referer'}) 
     114    assert_dom_equal "<a href=\"http://www.example.com/referer\">go back</a>", link_to('go back', :back) 
     115  end 
     116 
     117  def test_link_tag_with_back_and_no_referer 
     118    @controller.request = RequestMock.new("http://www.example.com/weblog/show", nil, nil, {}) 
     119    assert_dom_equal "<a href=\"javascript:history.back()\">go back</a>", link_to('go back', :back) 
    110120  end 
    111121