spec/unit/sucker/response_spec.rb in sucker-0.5.0 vs spec/unit/sucker/response_spec.rb in sucker-0.6.0
- old
+ new
@@ -3,11 +3,11 @@
module Sucker
describe Response do
before do
curl = Sucker.new.curl
curl.stub(:get).and_return(nil)
- curl.stub!(:body_str).and_return("<foo bar='baz' />")
+ curl.stub!(:body_str).and_return('<?xml version="1.0" ?><books><book><creator role="author">Gilles Deleuze</author><title>A Thousand Plateaus</title></book><book><creator role="author">Gilles Deleuze</author><title>Anti-Oedipus</title></book></books>')
curl.stub!(:response_code).and_return(200)
curl.stub!(:total_time).and_return(1.0)
@response = Response.new(curl)
end
@@ -27,8 +27,12 @@
context "to_h" do
it "returns a hash" do
@response.to_h.should be_an_instance_of Hash
end
+
+ it "converts a content hash to string" do
+ @response.to_h["books"]["book"].first["title"].should be_an_instance_of String
+ end
end
end
-end
\ No newline at end of file
+end