Sha256: 9e48900c293b593d7c6b1d92e38142485de65e9745da32356dec94d37fc7241a

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

#
# Testing rufus-verbs
#
# jmettraux@gmail.com
#
# Sun Jan 13 12:33:03 JST 2008
#


require File.dirname(__FILE__) + '/base.rb'


class Cookie1Test < Test::Unit::TestCase
  include TestBaseMixin

  include Rufus::Verbs


  def test_0

    ep = EndPoint.new :cookies => true
    class << ep
      attr_reader :cookies
    end

    assert_equal 0, ep.cookies.size

    ep.get :uri => "http://localhost:7777/cookie"
    assert_equal 1, ep.cookies.size

    req = ep.get :uri => "http://localhost:7777/cookie", :dry_run => true
    assert_match /^tcookie=\d*$/, req['Cookie']
  end

  def test_1

    ep0 = EndPoint.new :cookies => true
    ep1 = EndPoint.new :cookies => true

    ep0.post("http://localhost:7777/cookie") { "smurf0" }
    ep1.post("http://localhost:7777/cookie") { "smurf1" }

    expect 200, [ 'smurf0' ], ep0.get("http://localhost:7777/cookie")
    expect 200, [ 'smurf1' ], ep1.get("http://localhost:7777/cookie")
  end

  def test_2

    ep = EndPoint.new :cookies => false # explicitely

    res0 = ep.post("http://localhost:7777/cookie") { "smurf0" }
    res1 = expect 200, [], ep.get("http://localhost:7777/cookie")

    assert_not_equal res0['Set-Cookie'], res1['Set-Cookie']
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rufus-verbs-1.0.1 test/cookie1_test.rb
rufus-verbs-1.0.0 test/cookie1_test.rb