Module: CGI::Etest

Defined in:
lib/vex/base/cgi_ext.rb

Instance Method Summary collapse

Instance Method Details

#test_url_forObject



27
28
29
30
31
32
33
34
35
# File 'lib/vex/base/cgi_ext.rb', line 27

def test_url_for
  assert_equal "http://ix.de", CGI.url_for("http://ix.de")
  assert_equal "http://ix.de?a", CGI.url_for("http://ix.de", :a => nil)
  assert_equal "http://ix.de?a", CGI.url_for("http://ix.de", [ :a ])
  assert_equal "http://ix.de?a=1", CGI.url_for("http://ix.de", :a => 1 )
  assert_equal "http://ix.de?a=1", CGI.url_for("http://ix.de", [ [ :a, 1 ]] )
  assert_equal "http://ix.de?a=1&b=bb", CGI.url_for("http://ix.de", [ [ :a, 1 ], [ :b, :bb ]] )
  assert_equal "http://ix.de?a=b%3D1", CGI.url_for("http://ix.de", :a => "b=1" )
end

#test_url_for_mergingObject



37
38
39
40
41
42
43
# File 'lib/vex/base/cgi_ext.rb', line 37

def test_url_for_merging
  assert_equal "http://ix.de/a/b", CGI.url_for("http://ix.de", "a", "b")
  assert_equal "http://ix.de/a/b", CGI.url_for("http://ix.de/", "a/", "b")
  assert_equal "http://ix.de/a/b", CGI.url_for("http://ix.de/", "/a/", "/b/")
  assert_equal "http://ix.de//x/y", CGI.url_for("http://ix.de//", "/x/y")
  assert_equal "http://ix.de//x///y", CGI.url_for("http://ix.de//", "/x///y")
end