rufus-jig 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/ut_6_args.rb ADDED
@@ -0,0 +1,89 @@
1
+
2
+ #
3
+ # testing rufus-jig
4
+ #
5
+ # Sun Nov 8 11:57:39 JST 2009
6
+ #
7
+
8
+ require File.join(File.dirname(__FILE__), 'base')
9
+
10
+
11
+ class UtArgsTest < Test::Unit::TestCase
12
+
13
+ def test_extract_args
14
+
15
+ # [ http, path, payload, opts ]
16
+
17
+ a = eh(false, 'http://127.0.0.1:5984')
18
+ assert_equal '127.0.0.1', a[0].host
19
+ assert_equal 5984, a[0].port
20
+ assert_equal '/', a[1]
21
+ assert_equal nil, a[2]
22
+ assert_equal '{}', a[3].inspect
23
+
24
+ a = eh(false, '127.0.0.1', 5984, '/')
25
+ assert_equal '127.0.0.1', a[0].host
26
+ assert_equal 5984, a[0].port
27
+ assert_equal '/', a[1]
28
+ assert_equal nil, a[2]
29
+ assert_equal '{}', a[3].inspect
30
+
31
+ a = eh(false, '127.0.0.1', 5984, '/', :option => true)
32
+ assert_equal '127.0.0.1', a[0].host
33
+ assert_equal 5984, a[0].port
34
+ assert_equal '/', a[1]
35
+ assert_equal nil, a[2]
36
+ assert_equal '{:option=>true}', a[3].inspect
37
+ end
38
+
39
+ def test_payload_expected
40
+
41
+ a = eh(true, 'http://127.0.0.1:5984', [ 1, 2, 3 ])
42
+ assert_equal '127.0.0.1', a[0].host
43
+ assert_equal 5984, a[0].port
44
+ assert_equal '/', a[1]
45
+ assert_equal [ 1, 2, 3 ], a[2]
46
+ assert_equal '{}', a[3].inspect
47
+
48
+ assert_raise(ArgumentError) {
49
+ eh(true, 'http://127.0.0.1:5984', :nada, [ 1, 2, 3 ])
50
+ }
51
+ end
52
+
53
+ def test_payload_is_a_hash
54
+
55
+ a = eh(true, 'http://127.0.0.1:5984', { 'cheese' => 'burger' })
56
+ assert_equal '127.0.0.1', a[0].host
57
+ assert_equal 5984, a[0].port
58
+ assert_equal '/', a[1]
59
+ assert_equal '{"cheese"=>"burger"}', a[2].inspect
60
+ assert_equal '{}', a[3].inspect
61
+
62
+ a = eh(true, 'http://127.0.0.1:5984', { 'cheese' => 'burger' }, { :cache => true })
63
+ assert_equal '127.0.0.1', a[0].host
64
+ assert_equal 5984, a[0].port
65
+ assert_equal '/', a[1]
66
+ assert_equal '{"cheese"=>"burger"}', a[2].inspect
67
+ assert_equal '{:cache=>true}', a[3].inspect
68
+ end
69
+
70
+ def test_with_http_instance
71
+
72
+ h = Rufus::Jig::Http.new('127.0.0.1', 5984)
73
+
74
+ a = eh(true, h, '/', { 'cheese' => 'burger' })
75
+ assert_equal '127.0.0.1', a[0].host
76
+ assert_equal 5984, a[0].port
77
+ assert_equal '/', a[1]
78
+ assert_equal '{"cheese"=>"burger"}', a[2].inspect
79
+ assert_equal '{}', a[3].inspect
80
+ end
81
+
82
+ protected
83
+
84
+ def eh (pe, *args)
85
+
86
+ Rufus::Jig::Http.extract_http(pe, *args)
87
+ end
88
+ end
89
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-jig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -10,10 +10,19 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-12-15 00:00:00 +09:00
13
+ date: 2009-12-17 00:00:00 +09:00
14
14
  default_executable:
15
- dependencies: []
16
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: yard
18
+ type: :development
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ version:
17
26
  description: "\n Json Internet Get.\n\n An HTTP client, greedy with JSON content, GETting conditionally.\n\n Uses Patron and Yajl-ruby whenever possible.\n "
18
27
  email: jmettraux@gmail.com
19
28
  executables: []
@@ -21,31 +30,43 @@ executables: []
21
30
  extensions: []
22
31
 
23
32
  extra_rdoc_files:
33
+ - LICENSE.txt
24
34
  - README.rdoc
35
+ files:
36
+ - .gitignore
25
37
  - CHANGELOG.txt
26
38
  - CREDITS.txt
27
39
  - LICENSE.txt
28
- files:
40
+ - README.rdoc
41
+ - Rakefile
42
+ - TODO.txt
43
+ - lib/rufus-jig.rb
44
+ - lib/rufus/jig.rb
29
45
  - lib/rufus/jig/couch.rb
30
46
  - lib/rufus/jig/http.rb
31
47
  - lib/rufus/jig/json.rb
32
48
  - lib/rufus/jig/path.rb
33
- - lib/rufus/jig.rb
34
- - lib/rufus-jig.rb
35
- - CHANGELOG.txt
36
- - CREDITS.txt
37
- - LICENSE.txt
38
- - TODO.txt
39
- - delete.txt
40
- - put.txt
41
- - README.rdoc
49
+ - rufus-jig.gemspec
50
+ - test/base.rb
51
+ - test/couch_base.rb
52
+ - test/ct_0_couch.rb
53
+ - test/ct_1_couchdb.rb
54
+ - test/server.rb
55
+ - test/test.rb
56
+ - test/ut_0_http_get.rb
57
+ - test/ut_1_http_post.rb
58
+ - test/ut_2_http_delete.rb
59
+ - test/ut_3_http_put.rb
60
+ - test/ut_4_http_prefix.rb
61
+ - test/ut_5_http_misc.rb
62
+ - test/ut_6_args.rb
42
63
  has_rdoc: true
43
- homepage: http://github.com/jmettraux/rufus-jig
64
+ homepage: http://github.com/jmettraux/rufus-jig/
44
65
  licenses: []
45
66
 
46
67
  post_install_message:
47
- rdoc_options: []
48
-
68
+ rdoc_options:
69
+ - --charset=UTF-8
49
70
  require_paths:
50
71
  - lib
51
72
  required_ruby_version: !ruby/object:Gem::Requirement
data/delete.txt DELETED
@@ -1,21 +0,0 @@
1
- $ curl -vX DELETE 'http://localhost:5984/nada/doc4?rev=1-154674290868ca95f26ead035328e2ea'
2
- * About to connect() to localhost port 5984 (#0)
3
- * Trying 127.0.0.1... connected
4
- * Connected to localhost (127.0.0.1) port 5984 (#0)
5
- > DELETE /nada/doc4?rev=1-154674290868ca95f26ead035328e2ea HTTP/1.1
6
- > User-Agent: curl/7.19.6 (i386-apple-darwin10.0.0) libcurl/7.19.6 zlib/1.2.3
7
- > Host: localhost:5984
8
- > Accept: */*
9
- >
10
- < HTTP/1.1 200 OK
11
- < Server: CouchDB/0.10.0 (Erlang OTP/R13B)
12
- < Etag: "2-575dc2a2afa69152c502f4d07cc983dc"
13
- < Date: Sun, 01 Nov 2009 09:39:25 GMT
14
- < Content-Type: text/plain;charset=utf-8
15
- < Content-Length: 67
16
- < Cache-Control: must-revalidate
17
- <
18
- {"ok":true,"id":"doc4","rev":"2-575dc2a2afa69152c502f4d07cc983dc"}
19
- * Connection #0 to host localhost left intact
20
- * Closing connection #0
21
-
data/put.txt DELETED
@@ -1,25 +0,0 @@
1
-
2
- $ curl -vX PUT 'http://localhost:5984/nada/doc3' -d '{"ok":"surf"}'
3
- * About to connect() to localhost port 5984 (#0)
4
- * Trying 127.0.0.1... connected
5
- * Connected to localhost (127.0.0.1) port 5984 (#0)
6
- > PUT /nada/doc3 HTTP/1.1
7
- > User-Agent: curl/7.19.6 (i386-apple-darwin10.0.0) libcurl/7.19.6 zlib/1.2.3
8
- > Host: localhost:5984
9
- > Accept: */*
10
- > Content-Length: 13
11
- > Content-Type: application/x-www-form-urlencoded
12
- >
13
- < HTTP/1.1 201 Created
14
- < Server: CouchDB/0.10.0 (Erlang OTP/R13B)
15
- < Location: http://localhost:5984/nada/doc3
16
- < Etag: "1-34de3386a65dc370c7989ec08155a4d2"
17
- < Date: Sun, 01 Nov 2009 05:43:35 GMT
18
- < Content-Type: text/plain;charset=utf-8
19
- < Content-Length: 67
20
- < Cache-Control: must-revalidate
21
- <
22
- {"ok":true,"id":"doc3","rev":"1-34de3386a65dc370c7989ec08155a4d2"}
23
- * Connection #0 to host localhost left intact
24
- * Closing connection #0
25
-