spec/connection_spec.rb in plaid-1.6.0 vs spec/connection_spec.rb in plaid-1.6.1
- old
+ new
@@ -41,10 +41,15 @@
it "throws a Plaid::NotFound on 404 response" do
stub = stub_request(:post, stub_url).to_return(status: 404, body: req_not_found)
expect { Plaid::Connection.post("testing") }.to raise_error(Plaid::NotFound, "product not found")
end
+
+ it "throws a Plaid::ServerError on empty response" do
+ stub = stub_request(:post, stub_url).to_return(status: 504, body: '')
+ expect { Plaid::Connection.post("testing") }.to raise_error(Plaid::ServerError, '')
+ end
end
describe "#get" do
it "sends a get request" do
stub = stub_request(:get, stub_url).to_return({:body => {"response" => "OK"}.to_json})
@@ -122,10 +127,15 @@
it "throws a Plaid::NotFound on 404 response" do
stub = stub_request(:get, stub_url).to_return(status: 404, body: req_not_found)
expect { Plaid::Connection.secure_get("testing", "test_wells") }.to raise_error(Plaid::NotFound, "product not found")
end
+
+ it "throws a Plaid::ServerError on empty response" do
+ stub = stub_request(:get, stub_url).to_return(status: 504, body: '')
+ expect { Plaid::Connection.secure_get("testing", "test_wells") }.to raise_error(Plaid::ServerError, '')
+ end
end
describe "#patch" do
it "sends a patch request" do
stub = stub_request(:patch, stub_url).to_return({:body => {"response" => "OK"}.to_json})
@@ -161,9 +171,14 @@
end
it "throws a Plaid::NotFound on 404 response" do
stub = stub_request(:patch, stub_url).to_return(status: 404, body: req_not_found)
expect { Plaid::Connection.patch("testing") }.to raise_error(Plaid::NotFound, "product not found")
+ end
+
+ it "throws a Plaid::ServerError on empty response" do
+ stub = stub_request(:patch, stub_url).to_return(status: 504, body: '')
+ expect { Plaid::Connection.patch("testing") }.to raise_error(Plaid::ServerError, '')
end
end
describe "#delete" do
it "sends a delete request" do