1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Fixed failing specs.

This commit is contained in:
John Nunemaker 2008-10-25 00:34:25 -04:00
parent 31ad4f91c8
commit f90c40914a

View file

@ -66,12 +66,12 @@ describe HTTParty do
describe "format" do
it "should allow xml" do
Foo.format :xml
Foo.instance_variable_get("@format").should == 'xml'
Foo.instance_variable_get("@format").should == :xml
end
it "should allow json" do
Foo.format :json
Foo.instance_variable_get("@format").should == 'json'
Foo.instance_variable_get("@format").should == :json
end
it 'should not allow funky format' do
@ -91,24 +91,6 @@ describe HTTParty do
end
end
describe "deriving format from path" do
it "should work if there is extension and extension is an allowed format" do
%w[xml json].each do |ext|
Foo.send(:format_from_path, "/foo/bar.#{ext}").should == ext
end
end
it "should NOT work if there is extension but extention is not allow format" do
Foo.send(:format_from_path, '/foo/bar.php').should == nil
end
it 'should NOT work if there is no extension' do
['', '.'].each do |ext|
Foo.send(:format_from_path, "/foo/bar#{ext}").should == nil
end
end
end
describe 'parsing responses' do
it 'should handle xml automatically' do
xml = %q[<books><book><id>1234</id><name>Foo Bar!</name></book></books>]