test/stripe/api_resource_test.rb in stripe-1.55.0 vs test/stripe/api_resource_test.rb in stripe-1.55.1
- old
+ new
@@ -298,9 +298,21 @@
assert_equal(true, !!e.http_body)
assert_equal(true, e.json_body.kind_of?(Hash))
end
end
+ should "a 403 should give a PermissionError with http status, body, and JSON body" do
+ response = make_response(make_missing_id_error, 403)
+ @mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 403))
+ begin
+ Stripe::Customer.retrieve("foo")
+ rescue Stripe::PermissionError => e
+ assert_equal(403, e.http_status)
+ assert_equal(true, !!e.http_body)
+ assert_equal(true, e.json_body.kind_of?(Hash))
+ end
+ end
+
should "a 404 should give an InvalidRequestError with http status, body, and JSON body" do
response = make_response(make_missing_id_error, 404)
@mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 404))
begin
Stripe::Customer.retrieve("foo")