spec/unit/intercom/request_spec.rb in intercom-3.5.12 vs spec/unit/intercom/request_spec.rb in intercom-3.5.14
- old
+ new
@@ -6,9 +6,15 @@
response = OpenStruct.new(:code => 500)
req = Intercom::Request.new('path/', 'GET')
proc {req.parse_body('<html>somethjing</html>', response)}.must_raise(Intercom::ServerError)
end
+ it 'raises a RateLimitExceeded error when the response code is 429' do
+ response = OpenStruct.new(:code => 429)
+ req = Intercom::Request.new('path/', 'GET')
+ proc {req.parse_body('<html>somethjing</html>', response)}.must_raise(Intercom::RateLimitExceeded)
+ end
+
it 'parse_body returns nil if decoded_body is nil' do
response = OpenStruct.new(:code => 500)
req = Intercom::Request.new('path/', 'GET')
req.parse_body(nil, response).must_equal(nil)
end