Sha256: 51339cffe5917e3c058663202a1e7f6dbdc3aed4439987112954fc16cfe54da2

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

#
# Testing rufus-verbs
#
# jmettraux@gmail.com
#
# Mon Feb 18 13:00:36 JST 2008
#

require 'test/unit'
require 'testbase'

require 'rufus/verbs'


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

    include Rufus::Verbs

    def test_0

        uri = "http://localhost:7777/items"

        res = fopen uri
        assert_equal 200, res.code.to_i
        assert_equal "{}", res.body.strip

        res = fopen "file:CHANGELOG.txt"
        assert_kind_of String, res.read

        res = fopen "CHANGELOG.txt"
        assert_kind_of String, res.read

        res = fopen "http://localhost:7777/things"
        assert_equal 200, res.code.to_i
        assert_equal "{}", res.body.strip
            #
            # it follows redirections :)

        res = fopen "http://localhost:7777/things", :noredir => true
        assert_equal 303, res.code.to_i

        fopen "CHANGELOG.txt" do |f|
            assert_kind_of String, f.read
        end

        fopen "http://localhost:7777/things" do |res|
            assert_equal 200, res.code.to_i
            assert_equal "{}", res.body.strip
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rufus-verbs-0.8 test/fopen_test.rb