public
Description: GET, POST, PUT, DELETE, with something around (ruby)
Homepage: http://rufus.rubyforge.org/rufus-verbs
Clone URL: git://github.com/jmettraux/rufus-verbs.git
jmettraux (author)
Wed Apr 30 22:28:53 -0700 2008
commit  53ef8e94ca9995bcef04dc69e15e2d3454fe901a
tree    c2e7927bef03c22db556839f406fc2a10fcf8749
parent  b49482e567581e899e976930e0915d88f837aa60
rufus-verbs / test / block_test.rb
100644 50 lines (36 sloc) 1.047 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#
# Testing rufus-verbs
#
# jmettraux@gmail.com
#
# Sun Jan 13 20:02:25 JST 2008
#
 
require 'test/unit'
require 'testbase'
 
require 'rufus/verbs'
 
 
class BlockTest < Test::Unit::TestCase
    include TestBaseMixin
 
    include Rufus::Verbs
 
 
    def test_0
 
        res = post :uri => "http://localhost:7777/items/0" do
            "Fedor" +
            "Fedorovitch"
        end
        assert_equal 201, res.code.to_i
        assert_equal "http://localhost:7777/items/0", res['Location']
 
 
        expect(
            200,
            { 0 => "FedorFedorovitch" },
            get(:uri => "http://localhost:7777/things"))
 
        res = post :uri => "http://localhost:7777/items/1" do |req|
            # do whatever with the request [headers]
            "John"
        end
        assert_equal 201, res.code.to_i
        assert_equal "http://localhost:7777/items/1", res['Location']
 
        expect(
            200,
            { 0 => "FedorFedorovitch", 1 => "John" },
            get(:uri => "http://localhost:7777/things"))
    end
end