Permalink
Browse files

Now some tests for connection exceptions

  • Loading branch information...
1 parent ce3dc51 commit a40c162f4f412e062172834121d28a7763eabf83 harrisj committed Aug 19, 2008
Showing with 10 additions and 0 deletions.
  1. +10 −0 test/test_dbslayer_connection.rb
@@ -64,6 +64,16 @@ def test_server_error
@slayer.stubs(:cmd_execute).returns(ERROR_REPLY)
assert_raise(ActiveRecord::ConnectionAdapters::DbslayerException) { @slayer.sql_query("SELECT * FROM items") }
end
+
+ def test_http_error
+ @slayer.stubs(:cmd_execute).raises(OpenURI::HTTPError)
+ assert_raise(ActiveRecord::ConnectionAdapters::DbslayerException) { @slayer.sql_query("SELECT * FROM items") }
+ end
+
+ def test_json_error
+ @slayer.stubs(:cmd_execute).raises(OpenURI::HTTPError)
+ assert_raise(ActiveRecord::ConnectionAdapters::DbslayerException) { @slayer.sql_query("SELECT * FROM items") }
+ end
def test_client_num
@slayer.stubs(:cmd_execute).with(:db, {"CLIENT_VERSION" => true}).returns(VERSION_NUM_REPLY)

0 comments on commit a40c162

Please sign in to comment.