rufus-jig 0.1.23 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/CHANGELOG.txt +8 -0
- data/README.rdoc +41 -11
- data/Rakefile +37 -12
- data/TODO.txt +6 -3
- data/lib/rufus/jig/adapters/em.rb +21 -24
- data/lib/rufus/jig/adapters/net.rb +3 -4
- data/lib/rufus/jig/adapters/net_persistent.rb +26 -7
- data/lib/rufus/jig/adapters/patron.rb +25 -10
- data/lib/rufus/jig/couch.rb +199 -36
- data/lib/rufus/jig/http.rb +183 -90
- data/lib/rufus/jig/path.rb +4 -4
- data/lib/rufus/jig/version.rb +1 -1
- data/rufus-jig.gemspec +55 -34
- data/spec/couch/attachements_spec.rb +113 -0
- data/spec/couch/basic_auth_spec.rb +75 -0
- data/spec/couch/conditional_spec.rb +178 -0
- data/spec/couch/continuous.rb +97 -0
- data/spec/couch/couch_spec.rb +64 -0
- data/spec/couch/db_spec.rb +366 -0
- data/{test → spec/couch}/tweet.png +0 -0
- data/spec/couch/views_spec.rb +326 -0
- data/spec/couch_url.txt +2 -0
- data/spec/jig/basic_auth_spec.rb +51 -0
- data/spec/jig/conditional_spec.rb +76 -0
- data/spec/jig/delete_spec.rb +32 -0
- data/spec/jig/get_spec.rb +116 -0
- data/spec/jig/misc_spec.rb +120 -0
- data/spec/jig/new_spec.rb +95 -0
- data/spec/jig/parse_uri_spec.rb +139 -0
- data/spec/jig/post_spec.rb +79 -0
- data/spec/jig/prefix_spec.rb +51 -0
- data/spec/jig/put_spec.rb +68 -0
- data/spec/jig/timeout_spec.rb +94 -0
- data/{test → spec}/server.rb +14 -4
- data/spec/spec_helper.rb +61 -0
- data/spec/support/couch_helper.rb +14 -0
- data/spec/support/server_helper.rb +32 -0
- metadata +98 -43
- data/lib/rufus/jig/adapters/net_response.rb +0 -42
- data/test/base.rb +0 -53
- data/test/bm/bm0.rb +0 -49
- data/test/bm/bm1.rb +0 -43
- data/test/conc/put_vs_delete.rb +0 -28
- data/test/couch_base.rb +0 -52
- data/test/couch_url.txt +0 -1
- data/test/ct_0_couch.rb +0 -64
- data/test/ct_1_couchdb.rb +0 -204
- data/test/ct_2_couchdb_options.rb +0 -50
- data/test/ct_3_couchdb_views.rb +0 -106
- data/test/ct_4_attachments.rb +0 -126
- data/test/ct_5_couchdb_continuous.rb +0 -92
- data/test/cut_0_auth_couch.rb +0 -62
- data/test/test.rb +0 -28
- data/test/to.sh +0 -25
- data/test/tt_0_get_timeout.rb +0 -92
- data/test/ut_0_http_get.rb +0 -191
- data/test/ut_1_http_post.rb +0 -81
- data/test/ut_2_http_delete.rb +0 -42
- data/test/ut_3_http_put.rb +0 -105
- data/test/ut_4_http_prefix.rb +0 -50
- data/test/ut_5_http_misc.rb +0 -65
- data/test/ut_6_args.rb +0 -98
- data/test/ut_7_parse_uri.rb +0 -79
- data/test/ut_8_auth.rb +0 -37
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# specifiying rufus-jig
|
4
|
+
#
|
5
|
+
# Wed Dec 1 09:12:25 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
|
9
|
+
|
10
|
+
|
11
|
+
describe Rufus::Jig::Http do
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
purge_server
|
15
|
+
@h = Rufus::Jig::Http.new('127.0.0.1', 4567)
|
16
|
+
@h.put('/documents/xyz', 'data', :content_type => 'text/plain', :raw => true)
|
17
|
+
end
|
18
|
+
after(:each) do
|
19
|
+
@h.close
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#delete' do
|
23
|
+
|
24
|
+
it 'deletes' do
|
25
|
+
|
26
|
+
@h.delete('/documents/xyz')
|
27
|
+
|
28
|
+
@h.get('/documents/xyz').should == nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
#
|
4
|
+
# specifiying rufus-jig
|
5
|
+
#
|
6
|
+
# Tue Nov 30 10:53:59 JST 2010
|
7
|
+
#
|
8
|
+
|
9
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
|
10
|
+
|
11
|
+
|
12
|
+
describe Rufus::Jig::Http do
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
purge_server
|
16
|
+
@h = Rufus::Jig::Http.new('127.0.0.1', 4567)
|
17
|
+
end
|
18
|
+
after(:each) do
|
19
|
+
@h.close
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.new' do
|
23
|
+
|
24
|
+
after(:each) do
|
25
|
+
@http.close rescue nil
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'connects to the server' do
|
29
|
+
|
30
|
+
@http = Rufus::Jig::Http.new('127.0.0.1', 4567)
|
31
|
+
|
32
|
+
@h._path.should == ''
|
33
|
+
lambda { @h.get('/') }.should_not raise_error
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#get' do
|
38
|
+
|
39
|
+
context 'by default' do
|
40
|
+
|
41
|
+
it 'decodes from JSON' do
|
42
|
+
|
43
|
+
@h.get('/document').should == { 'car' => 'Mercedes-Benz' }
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns nil in case of 404' do
|
47
|
+
|
48
|
+
@h.get('/nada').should == nil
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'raises an error in case of server error' do
|
52
|
+
|
53
|
+
lambda {
|
54
|
+
@h.get('/server_error')
|
55
|
+
}.should raise_error(Rufus::Jig::HttpError)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'is OK with a non-ASCII URI' do
|
59
|
+
|
60
|
+
@h.get('/川崎').should == nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'with :raw => true' do
|
65
|
+
|
66
|
+
it 'returns an HTTP response instance' do
|
67
|
+
|
68
|
+
r = @h.get('/document', :raw => true)
|
69
|
+
|
70
|
+
r.status.should == 200
|
71
|
+
r.body.should == "{\"car\":\"Mercedes-Benz\"}"
|
72
|
+
end
|
73
|
+
|
74
|
+
it "doesn't raise an error in case of server error" do
|
75
|
+
|
76
|
+
lambda {
|
77
|
+
@h.get('/server_error', :raw => true)
|
78
|
+
}.should_not raise_error
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'with :accept => mime_type' do
|
83
|
+
|
84
|
+
it "returns the text/plain" do
|
85
|
+
|
86
|
+
@h.get('/document_accept', :accept => 'text/plain').should ==
|
87
|
+
'{"car":"Saab"}'
|
88
|
+
end
|
89
|
+
|
90
|
+
it "returns the application/json" do
|
91
|
+
|
92
|
+
@h.get('/document_accept', :accept => 'application/json').should == {
|
93
|
+
"car" => "Saab" }
|
94
|
+
end
|
95
|
+
|
96
|
+
it "returns JSON when :accept => :json" do
|
97
|
+
|
98
|
+
@h.get('/document_accept', :accept => :json).should == {
|
99
|
+
"car" => "Saab" }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'with :force_json => true' do
|
104
|
+
|
105
|
+
it "returns JSON anyway" do
|
106
|
+
|
107
|
+
@h.get('/document_accept', :accept => :json).should == {
|
108
|
+
"car" => "Saab" }
|
109
|
+
|
110
|
+
@h.get('/document_json_plain', :force_json => true).should == {
|
111
|
+
"car" => "Peugeot" }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
@@ -0,0 +1,120 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# specifiying rufus-jig
|
4
|
+
#
|
5
|
+
# Tue Nov 30 15:13:43 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
|
9
|
+
|
10
|
+
|
11
|
+
describe Rufus::Jig::Http do
|
12
|
+
|
13
|
+
after(:each) do
|
14
|
+
@h.close
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'with parameters' do
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
purge_server
|
21
|
+
@h = Rufus::Jig::Http.new('127.0.0.1', 4567)
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#get and co' do
|
25
|
+
|
26
|
+
it 'accepts get("/params")' do
|
27
|
+
|
28
|
+
@h.get('/params').should == {
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'accepts get("/params?a=b")' do
|
33
|
+
|
34
|
+
@h.get('/params?a=b').should == {
|
35
|
+
'a' => 'b' }
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'accepts get("/params", :params => { "a" => "b" })' do
|
39
|
+
|
40
|
+
@h.get('/params', :params => { "a" => "b" }).should == {
|
41
|
+
'a' => 'b' }
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'accepts get("/params?a=b", :params => { "c" => "d" })' do
|
45
|
+
|
46
|
+
@h.get('/params?a=b', :params => { "c" => "d" }).should == {
|
47
|
+
'a' => 'b', 'c' => 'd' }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'absolute vs relative' do
|
53
|
+
|
54
|
+
describe '#get and co' do
|
55
|
+
|
56
|
+
context 'without a :prefix' do
|
57
|
+
|
58
|
+
before(:each) do
|
59
|
+
purge_server
|
60
|
+
@h = Rufus::Jig::Http.new('127.0.0.1', 4567)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'gets the right thing' do
|
64
|
+
|
65
|
+
@h.get('a/b/c').should == 'C'
|
66
|
+
@h.get('/a/b/c').should == 'C'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'with :prefix => ""' do
|
71
|
+
|
72
|
+
before(:each) do
|
73
|
+
purge_server
|
74
|
+
@h = Rufus::Jig::Http.new('127.0.0.1', 4567, :prefix => 'a/b')
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'gets the right thing' do
|
78
|
+
|
79
|
+
@h.get('a/b/c').should == nil
|
80
|
+
@h.get('/a/b/c').should == 'C'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'with :prefix => "a/b"' do
|
85
|
+
|
86
|
+
before(:each) do
|
87
|
+
purge_server
|
88
|
+
@h = Rufus::Jig::Http.new('127.0.0.1', 4567, :prefix => 'a/b')
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'gets the right thing' do
|
92
|
+
|
93
|
+
@h.get('c').should == 'C'
|
94
|
+
@h.get('/c').should == 'c'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'with :prefix => "/a/b"' do
|
99
|
+
|
100
|
+
before(:each) do
|
101
|
+
purge_server
|
102
|
+
@h = Rufus::Jig::Http.new('127.0.0.1', 4567, :prefix => '/a/b')
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'gets the right thing' do
|
106
|
+
|
107
|
+
@h.get('c').should == 'C'
|
108
|
+
@h.get('/c').should == 'c'
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'gets the right document' do
|
112
|
+
|
113
|
+
@h.get('document').should == nil
|
114
|
+
@h.get('/document').should == { 'car' => 'Mercedes-Benz' }
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# specifiying rufus-jig
|
4
|
+
#
|
5
|
+
# Wed Dec 1 14:41:56 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
|
9
|
+
|
10
|
+
|
11
|
+
describe Rufus::Jig::Http do
|
12
|
+
|
13
|
+
describe '.new' do
|
14
|
+
|
15
|
+
it 'accepts ("http://127.0.0.1:5984")' do
|
16
|
+
|
17
|
+
h = Rufus::Jig::Http.new("http://127.0.0.1:5984")
|
18
|
+
|
19
|
+
h.scheme.should == 'http'
|
20
|
+
h.host.should == '127.0.0.1'
|
21
|
+
h.port.should == 5984
|
22
|
+
h._path.should == ''
|
23
|
+
h._query.should == nil
|
24
|
+
h._fragment.should == nil
|
25
|
+
h.options[:basic_auth].should == nil
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'accepts ("http://127.0.0.1:5984/nada?a=b&c=d")' do
|
29
|
+
|
30
|
+
h = Rufus::Jig::Http.new("http://127.0.0.1:5984/nada?a=b&c=d")
|
31
|
+
|
32
|
+
h.scheme.should == 'http'
|
33
|
+
h.host.should == '127.0.0.1'
|
34
|
+
h.port.should == 5984
|
35
|
+
h._path.should == '/nada'
|
36
|
+
h._query.should == 'a=b&c=d'
|
37
|
+
h._fragment.should == nil
|
38
|
+
h.options[:basic_auth].should == nil
|
39
|
+
end
|
40
|
+
|
41
|
+
it "accepts ('127.0.0.1', 5984)" do
|
42
|
+
|
43
|
+
h = Rufus::Jig::Http.new('127.0.0.1', 5984)
|
44
|
+
|
45
|
+
h.scheme.should == 'http'
|
46
|
+
h.host.should == '127.0.0.1'
|
47
|
+
h.port.should == 5984
|
48
|
+
h._path.should == ''
|
49
|
+
h._query.should == nil
|
50
|
+
h._fragment.should == nil
|
51
|
+
h.options[:basic_auth].should == nil
|
52
|
+
end
|
53
|
+
|
54
|
+
it "accepts ('127.0.0.1', 5984, '/banana')" do
|
55
|
+
|
56
|
+
h = Rufus::Jig::Http.new('127.0.0.1', 5984, '/banana')
|
57
|
+
|
58
|
+
h.scheme.should == 'http'
|
59
|
+
h.host.should == '127.0.0.1'
|
60
|
+
h.port.should == 5984
|
61
|
+
h._path.should == '/banana'
|
62
|
+
h._query.should == nil
|
63
|
+
h._fragment.should == nil
|
64
|
+
h.options[:basic_auth].should == nil
|
65
|
+
end
|
66
|
+
|
67
|
+
it "accepts ('127.0.0.1', 5984, '/banana', :basic_auth => %w[ u p ])" do
|
68
|
+
|
69
|
+
h = Rufus::Jig::Http.new(
|
70
|
+
'127.0.0.1', 5984, '/banana', :basic_auth => %w[ u p ])
|
71
|
+
|
72
|
+
h.scheme.should == 'http'
|
73
|
+
h.host.should == '127.0.0.1'
|
74
|
+
h.port.should == 5984
|
75
|
+
h._path.should == '/banana'
|
76
|
+
h._query.should == nil
|
77
|
+
h._fragment.should == nil
|
78
|
+
h.options[:basic_auth].should == %w[ u p ]
|
79
|
+
end
|
80
|
+
|
81
|
+
it "accepts ('http://127.0.0.1:5984', '/banana')" do
|
82
|
+
|
83
|
+
h = Rufus::Jig::Http.new('http://127.0.0.1:5984', '/banana')
|
84
|
+
|
85
|
+
h.scheme.should == 'http'
|
86
|
+
h.host.should == '127.0.0.1'
|
87
|
+
h.port.should == 5984
|
88
|
+
h._path.should == '/banana'
|
89
|
+
h._query.should == nil
|
90
|
+
h._fragment.should == nil
|
91
|
+
h.options[:basic_auth].should == nil
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
#
|
4
|
+
# specifiying rufus-jig
|
5
|
+
#
|
6
|
+
# Tue Nov 30 15:13:43 JST 2010
|
7
|
+
#
|
8
|
+
|
9
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
|
10
|
+
|
11
|
+
|
12
|
+
describe Rufus::Jig do
|
13
|
+
|
14
|
+
def test_parse_host
|
15
|
+
|
16
|
+
assert_equal 'www.unifr.ch', Rufus::Jig.parse_host('http://www.unifr.ch')
|
17
|
+
assert_equal 'mufg.jp', Rufus::Jig.parse_host('http://mufg.jp/大和')
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '.parse_host' do
|
21
|
+
|
22
|
+
it 'is OK with a URI without a path' do
|
23
|
+
|
24
|
+
Rufus::Jig.parse_host('http://www.unifr.ch').should == 'www.unifr.ch'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'is OK with a URI with a path' do
|
28
|
+
|
29
|
+
Rufus::Jig.parse_host('http://mufg.jp/ginkou').should == 'mufg.jp'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'is OK with a URI where the path is non-ASCII' do
|
33
|
+
|
34
|
+
Rufus::Jig.parse_host('http://mufg.jp/大和').should == 'mufg.jp'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '.parse_uri' do
|
39
|
+
|
40
|
+
it 'returns an instance of Rufus::Jig::Uri' do
|
41
|
+
|
42
|
+
Rufus::Jig.parse_uri('http://www.unifr.ch').class.should ==
|
43
|
+
Rufus::Jig::Uri
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'identifies the scheme correctly' do
|
47
|
+
|
48
|
+
Rufus::Jig.parse_uri('http://www.unifr.ch').scheme.should == 'http'
|
49
|
+
Rufus::Jig.parse_uri('https://www.unifr.ch').scheme.should == 'https'
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'identifies the host correctly' do
|
53
|
+
|
54
|
+
Rufus::Jig.parse_uri('/').host.should == nil
|
55
|
+
|
56
|
+
Rufus::Jig.parse_uri('http://www.nada.ch').host.should == 'www.nada.ch'
|
57
|
+
Rufus::Jig.parse_uri('https://www.nada.ch').host.should == 'www.nada.ch'
|
58
|
+
Rufus::Jig.parse_uri('https://127.0.0.1').host.should == '127.0.0.1'
|
59
|
+
Rufus::Jig.parse_uri('https://localhost').host.should == 'localhost'
|
60
|
+
|
61
|
+
Rufus::Jig.parse_uri('http://www.nada.ch/a').host.should == 'www.nada.ch'
|
62
|
+
Rufus::Jig.parse_uri('https://www.nada.ch/a').host.should == 'www.nada.ch'
|
63
|
+
Rufus::Jig.parse_uri('https://127.0.0.1/a').host.should == '127.0.0.1'
|
64
|
+
Rufus::Jig.parse_uri('https://localhost/a').host.should == 'localhost'
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'identifies the port correctly' do
|
68
|
+
|
69
|
+
Rufus::Jig.parse_uri('http://www.unifr.ch').port.should == 80
|
70
|
+
Rufus::Jig.parse_uri('https://www.unifr.ch').port.should == 443
|
71
|
+
Rufus::Jig.parse_uri('http://www.unifr.ch/a').port.should == 80
|
72
|
+
Rufus::Jig.parse_uri('https://www.unifr.ch/a').port.should == 443
|
73
|
+
Rufus::Jig.parse_uri('http://www.unifr.ch:1234').port.should == 1234
|
74
|
+
Rufus::Jig.parse_uri('http://www.unifr.ch:1234/a').port.should == 1234
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'identifies the path correctly' do
|
78
|
+
|
79
|
+
Rufus::Jig.parse_uri('http://example.ch').path.should == ''
|
80
|
+
Rufus::Jig.parse_uri('http://example.ch/a').path.should == '/a'
|
81
|
+
Rufus::Jig.parse_uri('http://example.ch/大和').path.should == '/大和'
|
82
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a').path.should == '/a'
|
83
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a#b').path.should == '/a'
|
84
|
+
Rufus::Jig.parse_uri('a').path.should == 'a'
|
85
|
+
Rufus::Jig.parse_uri('a#b').path.should == 'a'
|
86
|
+
Rufus::Jig.parse_uri('/a').path.should == '/a'
|
87
|
+
Rufus::Jig.parse_uri('/a#b').path.should == '/a'
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'identifies the query correctly' do
|
91
|
+
|
92
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a').query.should == nil
|
93
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a?b=c').query.should == 'b=c'
|
94
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a?b=c&d=e').query.should == 'b=c&d=e'
|
95
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a?b=c#d').query.should == 'b=c'
|
96
|
+
Rufus::Jig.parse_uri('/a').query.should == nil
|
97
|
+
Rufus::Jig.parse_uri('/a?b=c').query.should == 'b=c'
|
98
|
+
Rufus::Jig.parse_uri('/a?b=c&d=e').query.should == 'b=c&d=e'
|
99
|
+
Rufus::Jig.parse_uri('/a?b=c#d').query.should == 'b=c'
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'identifies the fragment correctly' do
|
103
|
+
|
104
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a').fragment.should == nil
|
105
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a#b').fragment.should == 'b'
|
106
|
+
Rufus::Jig.parse_uri('a#b').fragment.should == 'b'
|
107
|
+
Rufus::Jig.parse_uri('/a#b').fragment.should == 'b'
|
108
|
+
Rufus::Jig.parse_uri('a#奈良').fragment.should == '奈良'
|
109
|
+
Rufus::Jig.parse_uri('/a#奈良').fragment.should == '奈良'
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'identifies the user and pass correctly' do
|
113
|
+
|
114
|
+
Rufus::Jig.parse_uri('/').username.should == nil
|
115
|
+
Rufus::Jig.parse_uri('/').password.should == nil
|
116
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a').username.should == nil
|
117
|
+
Rufus::Jig.parse_uri('http://example.ch:80/a').password.should == nil
|
118
|
+
|
119
|
+
Rufus::Jig.parse_uri('http://a:b@example.ch:80/a').username.should == 'a'
|
120
|
+
Rufus::Jig.parse_uri('http://a:b@example.ch:80/a').password.should == 'b'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe Rufus::Jig::Uri do
|
126
|
+
|
127
|
+
describe '#to_s' do
|
128
|
+
|
129
|
+
it "flips burgers" do
|
130
|
+
|
131
|
+
s = Rufus::Jig.parse_uri('http://example.ch:80/a').to_s.should ==
|
132
|
+
'http://example.ch:80/a'
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe '#tail_to_s' do
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|