Sha256: 97a1f0b2893429dba2bc59788e051f006d8669b039c36b2c1884816d47012044

Contents?: true

Size: 752 Bytes

Versions: 14

Compression:

Stored size: 752 Bytes

Contents

# encoding: utf-8

require_relative 'test_helper'

class CgiExtTest < Test::Unit::TestCase
  def test_url_for
    assert_equal "/abc",              CGI.url_for("/abc")
    assert_equal "/abc?p=12",         CGI.url_for("/abc", :p => 12)
    assert_equal "/abc?a=1&b=1&p=12", CGI.url_for("/abc?a=1&b=1", :p => 12)
    assert_equal "/abc?p=1&p=12",     CGI.url_for("/abc?p=1", :p => 12)
  end

  def test_url_for_escaping
    assert_equal "/abc?p=foo+bar",        CGI.url_for("/abc", :p => "foo bar")
    assert_equal "/abc?p=foo+%3E+bar",    CGI.url_for("/abc", :p => "foo > bar")
    assert_equal "/abc?p=foo+%26+bar",    CGI.url_for("/abc", :p => "foo & bar")
    assert_equal "/abc?p=foo+%C3%A4+bar", CGI.url_for("/abc", :p => "foo รค bar")
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
radiospieler-2014.11.28 test/cgi_ext_test.rb
radiospieler-2013.04.01 test/cgi_ext_test.rb
radiospieler-2012.09.13 test/cgi_ext_test.rb
radiospieler-0.3.12 test/cgi_ext_test.rb
radiospieler-0.3.11 test/cgi_ext_test.rb
radiospieler-0.3.10 test/cgi_ext_test.rb
radiospieler-0.3.8 test/cgi_ext_test.rb
radiospieler-0.3.7 test/cgi_ext_test.rb
radiospieler-0.3.6 test/cgi_ext_test.rb
radiospieler-0.3.5 test/cgi_ext_test.rb
radiospieler-0.3.4 test/cgi_ext_test.rb
radiospieler-0.3.3 test/cgi_ext_test.rb
radiospieler-0.3.2 test/cgi_ext_test.rb
radiospieler-0.3.1 test/cgi_ext_test.rb