Sha256: 07c24cc9da2e74e627e5faaa6ce687853f463e4cbb130452f8ac857d42efa284

Contents?: true

Size: 1.26 KB

Versions: 18

Compression:

Stored size: 1.26 KB

Contents

#
# testing rufus-jig
#
# Sun Nov  1 13:00:46 JST 2009
#

require File.join(File.dirname(__FILE__), 'base')


class UtHttpMiscTest < Test::Unit::TestCase

  def teardown
    @h.close if @h
  end

  def test_prefix_with_slash

    @h = Rufus::Jig::Http.new('127.0.0.1', 4567, :prefix => '/a/b')

    assert_equal 'c', @h.get('/c')
    assert_equal 'C', @h.get('c')
  end

  def test_prefix_without_slash

    @h = Rufus::Jig::Http.new('127.0.0.1', 4567, :prefix => 'a/b')

    assert_equal 'c', @h.get('/c')
    assert_equal 'C', @h.get('c')
  end

  def test_without_prefix

    @h = Rufus::Jig::Http.new('127.0.0.1', 4567)

    assert_equal 'C', @h.get('/a/b/c')
    assert_equal 'C', @h.get('a/b/c')
  end

  def test_with_single_slash_prefix

    @h = Rufus::Jig::Http.new('127.0.0.1', 4567, :prefix => '/')

    assert_equal 'C', @h.get('/a/b/c')
    assert_equal 'C', @h.get('a/b/c')
  end

  def test_with_empty_prefix

    @h = Rufus::Jig::Http.new('127.0.0.1', 4567, :prefix => '')

    assert_equal 'C', @h.get('/a/b/c')
    assert_equal 'C', @h.get('a/b/c')
  end

  def test_no_prefix

    @h = Rufus::Jig::Http.new('127.0.0.1', 4567, :prefix => '/a/b')

    assert_equal({ 'car' => 'Mercedes-Benz' }, @h.get('/document'))
    assert_equal(nil, @h.get('document'))
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rufus-jig-0.1.23 test/ut_5_http_misc.rb
rufus-jig-0.1.22 test/ut_5_http_misc.rb
rufus-jig-0.1.21 test/ut_5_http_misc.rb
rufus-jig-0.1.20 test/ut_5_http_misc.rb
rufus-jig-0.1.19 test/ut_5_http_misc.rb
rufus-jig-0.1.18 test/ut_5_http_misc.rb
rufus-jig-0.1.17 test/ut_5_http_misc.rb
rufus-jig-0.1.16 test/ut_5_http_misc.rb
rufus-jig-0.1.15 test/ut_5_http_misc.rb
rufus-jig-0.1.14 test/ut_5_http_misc.rb
rufus-jig-0.1.13 test/ut_5_http_misc.rb
rufus-jig-0.1.12 test/ut_5_http_misc.rb
rufus-jig-0.1.11 test/ut_5_http_misc.rb
rufus-jig-0.1.10 test/ut_5_http_misc.rb
rufus-jig-0.1.9 test/ut_5_http_misc.rb
rufus-jig-0.1.8 test/ut_5_http_misc.rb
rufus-jig-0.1.7 test/ut_5_http_misc.rb
rufus-jig-0.1.6 test/ut_5_http_misc.rb