patron-new 0.4.19

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/spec/util_spec.rb ADDED
@@ -0,0 +1,92 @@
1
+ ## -------------------------------------------------------------------
2
+ ##
3
+ ## Copyright (c) 2008 The Hive http://www.thehive.com/
4
+ ##
5
+ ## Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ ## of this software and associated documentation files (the "Software"), to deal
7
+ ## in the Software without restriction, including without limitation the rights
8
+ ## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ ## copies of the Software, and to permit persons to whom the Software is
10
+ ## furnished to do so, subject to the following conditions:
11
+ ##
12
+ ## The above copyright notice and this permission notice shall be included in
13
+ ## all copies or substantial portions of the Software.
14
+ ##
15
+ ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ ## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ ## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ ## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ ## THE SOFTWARE.
22
+ ##
23
+ ## -------------------------------------------------------------------
24
+ require File.expand_path("./spec") + '/spec_helper.rb'
25
+
26
+ describe Patron::Util do
27
+
28
+ describe :build_query_pairs_from_hash do
29
+ it "correctly serializes a simple hash" do
30
+ hash = {:foo => "bar", "baz" => 42}
31
+ array = Patron::Util.build_query_pairs_from_hash(hash)
32
+ array.size.should == 2
33
+ array.should include("foo=bar")
34
+ array.should include("baz=42")
35
+ end
36
+ it "correctly serializes a more complex hash" do
37
+ hash = {
38
+ :foo => "bar",
39
+ :baz => {
40
+ "quux" => {
41
+ :zing => {
42
+ :ying => 42
43
+ }
44
+ },
45
+ :blargh => {
46
+ :spaz => "sox",
47
+ :razz => "matazz"
48
+ }
49
+ }
50
+ }
51
+ array = Patron::Util.build_query_pairs_from_hash(hash)
52
+ array.size.should == 4
53
+ array.should include("foo=bar")
54
+ array.should include("baz[quux][zing][ying]=42")
55
+ array.should include("baz[blargh][spaz]=sox")
56
+ array.should include("baz[blargh][razz]=matazz")
57
+ end
58
+ end
59
+
60
+ describe :build_query_string_from_hash do
61
+ it "correctly serializes a simple hash" do
62
+ hash = {:foo => "bar", "baz" => 42}
63
+ array = Patron::Util.build_query_string_from_hash(hash).split('&')
64
+ array.size.should == 2
65
+ array.should include("foo=bar")
66
+ array.should include("baz=42")
67
+ end
68
+ it "correctly serializes a more complex hash" do
69
+ hash = {
70
+ :foo => "bar",
71
+ :baz => {
72
+ "quux" => {
73
+ :zing => {
74
+ :ying => 42
75
+ }
76
+ },
77
+ :blargh => {
78
+ :spaz => "sox",
79
+ :razz => "matazz"
80
+ }
81
+ }
82
+ }
83
+ array = Patron::Util.build_query_string_from_hash(hash).split('&')
84
+ array.size.should == 4
85
+ array.should include("foo=bar")
86
+ array.should include("baz[quux][zing][ying]=42")
87
+ array.should include("baz[blargh][spaz]=sox")
88
+ array.should include("baz[blargh][razz]=matazz")
89
+ end
90
+ end
91
+
92
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: patron-new
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.19
5
+ platform: ruby
6
+ authors:
7
+ - Phillip Toland
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake-compiler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.5
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.7.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 2.3.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rcov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.9
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.9
69
+ description: Ruby HTTP client library based on libcurl, base on Patron, bug it keep
70
+ with the github code!
71
+ email:
72
+ - phil.toland@gmail.com
73
+ executables: []
74
+ extensions:
75
+ - ext/patron/extconf.rb
76
+ extra_rdoc_files: []
77
+ files:
78
+ - .autotest
79
+ - .gitignore
80
+ - .rspec
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - LICENSE
84
+ - README.txt
85
+ - Rakefile
86
+ - ext/patron/.gitignore
87
+ - ext/patron/extconf.rb
88
+ - ext/patron/membuffer.c
89
+ - ext/patron/membuffer.h
90
+ - ext/patron/session_ext.c
91
+ - ext/patron/sglib.h
92
+ - lib/patron.rb
93
+ - lib/patron/error.rb
94
+ - lib/patron/proxy_type.rb
95
+ - lib/patron/request.rb
96
+ - lib/patron/response.rb
97
+ - lib/patron/session.rb
98
+ - lib/patron/util.rb
99
+ - lib/patron/version.rb
100
+ - patron.gemspec
101
+ - pic.png
102
+ - script/console
103
+ - script/test_server
104
+ - spec/certs/cacert.pem
105
+ - spec/certs/privkey.pem
106
+ - spec/patron_spec.rb
107
+ - spec/request_spec.rb
108
+ - spec/response_spec.rb
109
+ - spec/session_spec.rb
110
+ - spec/session_ssl_spec.rb
111
+ - spec/spec_helper.rb
112
+ - spec/support/test_server.rb
113
+ - spec/util_spec.rb
114
+ homepage: https://github.com/toland/patron
115
+ licenses: []
116
+ metadata: {}
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ - ext
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: 1.2.0
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.1.11
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Patron HTTP Client
138
+ test_files: []