httparty 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of httparty might be problematic. Click here for more details.
- data/History +7 -1
- data/Manifest +1 -4
- data/README.rdoc +54 -0
- data/httparty.gemspec +5 -5
- data/lib/httparty.rb +8 -7
- data/lib/httparty/core_extensions.rb +6 -2
- data/lib/httparty/request.rb +16 -14
- data/lib/httparty/version.rb +1 -1
- data/spec/httparty/cookie_hash_spec.rb +1 -1
- data/spec/httparty/request_spec.rb +7 -4
- data/spec/httparty/response_spec.rb +1 -1
- data/spec/httparty_spec.rb +9 -2
- data/spec/spec_helper.rb +1 -1
- metadata +5 -8
- data/README +0 -36
- data/setup.rb +0 -1585
- data/spec/hash_spec.rb +0 -49
- data/spec/string_spec.rb +0 -27
data/spec/hash_spec.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
|
3
|
-
describe Hash, "to_xml_attributes" do
|
4
|
-
before do
|
5
|
-
@hash = { :one => "ONE", "two" => "TWO" }
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should turn the hash into xml attributes" do
|
9
|
-
attrs = @hash.to_xml_attributes
|
10
|
-
attrs.should match(/one="ONE"/m)
|
11
|
-
attrs.should match(/two="TWO"/m)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should preserve _ in hash keys' do
|
15
|
-
attrs = {
|
16
|
-
:some_long_attribute => "with short value",
|
17
|
-
:crash => :burn,
|
18
|
-
:merb => "uses extlib"
|
19
|
-
}.to_xml_attributes
|
20
|
-
|
21
|
-
attrs.should =~ /some_long_attribute="with short value"/
|
22
|
-
attrs.should =~ /merb="uses extlib"/
|
23
|
-
attrs.should =~ /crash="burn"/
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
describe Hash, 'to_params' do
|
29
|
-
{
|
30
|
-
{ "foo" => "bar", "baz" => "bat" } => "foo=bar&baz=bat",
|
31
|
-
{ "foo" => [ "bar", "baz" ] } => "foo[]=bar&foo[]=baz",
|
32
|
-
{ "foo" => [ {"bar" => "1"}, {"bar" => 2} ] } => "foo[][bar]=1&foo[][bar]=2",
|
33
|
-
{ "foo" => { "bar" => [ {"baz" => 1}, {"baz" => "2"} ] } } => "foo[bar][][baz]=1&foo[bar][][baz]=2",
|
34
|
-
{ "foo" => {"1" => "bar", "2" => "baz"} } => "foo[1]=bar&foo[2]=baz"
|
35
|
-
}.each do |hash, params|
|
36
|
-
it "should covert hash: #{hash.inspect} to params: #{params.inspect}" do
|
37
|
-
hash.to_params.split('&').sort.should == params.split('&').sort
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should not leave a trailing &' do
|
42
|
-
{ :name => 'Bob', :address => { :street => '111 Ruby Ave.', :city => 'Ruby Central', :phones => ['111-111-1111', '222-222-2222'] } }.to_params.should_not match(/&$/)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should URL encode unsafe characters' do
|
46
|
-
{:q => "?&\" +"}.to_params.should == "q=%3F%26%22%20%2B"
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
data/spec/string_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
describe String, "#snake_case" do
|
2
|
-
it "lowercases one word CamelCase" do
|
3
|
-
"Merb".snake_case.should == "merb"
|
4
|
-
end
|
5
|
-
|
6
|
-
it "makes one underscore snake_case two word CamelCase" do
|
7
|
-
"MerbCore".snake_case.should == "merb_core"
|
8
|
-
end
|
9
|
-
|
10
|
-
it "handles CamelCase with more than 2 words" do
|
11
|
-
"SoYouWantContributeToMerbCore".snake_case.should == "so_you_want_contribute_to_merb_core"
|
12
|
-
end
|
13
|
-
|
14
|
-
it "handles CamelCase with more than 2 capital letter in a row" do
|
15
|
-
"CNN".snake_case.should == "cnn"
|
16
|
-
"CNNNews".snake_case.should == "cnn_news"
|
17
|
-
"HeadlineCNNNews".snake_case.should == "headline_cnn_news"
|
18
|
-
end
|
19
|
-
|
20
|
-
it "does NOT change one word lowercase" do
|
21
|
-
"merb".snake_case.should == "merb"
|
22
|
-
end
|
23
|
-
|
24
|
-
it "leaves snake_case as is" do
|
25
|
-
"merb_core".snake_case.should == "merb_core"
|
26
|
-
end
|
27
|
-
end
|