spec/zelda/request_spec.rb in zelda-1.3.0 vs spec/zelda/request_spec.rb in zelda-1.4.0

- old
+ new

@@ -21,9 +21,15 @@ it "should raise an error without an API key" do api_key = Zelda.send(:remove_const, :API_KEY) lambda { Zelda::Request.get('foo') }.should raise_error("No Zelda::API_KEY specified") Zelda::API_KEY = api_key end + + it "should raise error given in the response" do + xml = File.read(File.dirname(__FILE__) + "/../responses/invalid_api_key.xml") + FakeWeb.register_uri(:get, "http://zelda.omroep.nl/12345/foo", :body => xml, :content_type => "text/xml") + lambda { Zelda::Request.get('foo') }.should raise_error("Invalid API key specified") + end describe "when returning an url" do it "should be correct with 1 args" do Zelda::Request.parse_url('foo').should == "http://zelda.omroep.nl/12345/foo" end