diff --git a/test/json_client_test.rb b/test/json_client_test.rb
index <HASH>..<HASH> 100644
--- a/test/json_client_test.rb
+++ b/test/json_client_test.rb
@@ -35,7 +35,8 @@ class JsonClientTest < MiniTest::Spec
 
   def test_long_connections_timeout
     url = "http://www.example.com/timeout.json"
-    stub_request(:get, url).to_raise(Net::OpenTimeout)
+    exception = defined?(Net::OpenTimeout) ? Net::OpenTimeout : TimeoutError
+    stub_request(:get, url).to_raise(exception)
     assert_raises GdsApi::TimedOutException do
       @client.get_json(url)
     end
Ruby <I> test compatibility

The actual code compatibility is handled within RestClient