Sha256: ddefd6ba412386d82eee51d07ce0f398371dec6a088bf25af3e5538822bd0fee

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

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

require 'test/unit'
require 'testbase'

require 'rufus/verbs'


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

8 entries across 8 versions & 1 rubygems

Version Path
rufus-verbs-0.9 test/cookie1_test.rb
rufus-verbs-0.8 test/cookie1_test.rb
rufus-verbs-0.3 test/cookie1_test.rb
rufus-verbs-0.4 test/cookie1_test.rb
rufus-verbs-0.10 test/cookie1_test.rb
rufus-verbs-0.6 test/cookie1_test.rb
rufus-verbs-0.7 test/cookie1_test.rb
rufus-verbs-0.5 test/cookie1_test.rb