mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Fixed failing specs.
This commit is contained in:
parent
31ad4f91c8
commit
f90c40914a
1 changed files with 2 additions and 20 deletions
|
@ -66,12 +66,12 @@ describe HTTParty do
|
||||||
describe "format" do
|
describe "format" do
|
||||||
it "should allow xml" do
|
it "should allow xml" do
|
||||||
Foo.format :xml
|
Foo.format :xml
|
||||||
Foo.instance_variable_get("@format").should == 'xml'
|
Foo.instance_variable_get("@format").should == :xml
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should allow json" do
|
it "should allow json" do
|
||||||
Foo.format :json
|
Foo.format :json
|
||||||
Foo.instance_variable_get("@format").should == 'json'
|
Foo.instance_variable_get("@format").should == :json
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not allow funky format' do
|
it 'should not allow funky format' do
|
||||||
|
@ -91,24 +91,6 @@ describe HTTParty do
|
||||||
end
|
end
|
||||||
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
|
describe 'parsing responses' do
|
||||||
it 'should handle xml automatically' do
|
it 'should handle xml automatically' do
|
||||||
xml = %q[<books><book><id>1234</id><name>Foo Bar!</name></book></books>]
|
xml = %q[<books><book><id>1234</id><name>Foo Bar!</name></book></books>]
|
||||||
|
|
Loading…
Add table
Reference in a new issue