test/stripe/api_resource_test.rb in stripe-1.25.0 vs test/stripe/api_resource_test.rb in stripe-1.26.0

- old
+ new

@@ -268,9 +268,21 @@ assert_equal(true, !!e.http_body) assert_equal(true, e.json_body.kind_of?(Hash)) end end + should "a 429 should give a RateLimitError with http status, body, and JSON body" do + response = make_response(make_rate_limit_error, 429) + @mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 429)) + begin + Stripe::Customer.retrieve("foo") + rescue Stripe::RateLimitError => e + assert_equal(429, e.http_status) + assert_equal(true, !!e.http_body) + assert_equal(true, e.json_body.kind_of?(Hash)) + end + end + should "setting a nil value for a param should exclude that param from the request" do @mock.expects(:get).with do |url, api_key, params| uri = URI(url) query = CGI.parse(uri.query) (url =~ %r{^#{Stripe.api_base}/v1/charges?} &&