Permalink
Browse files

Tweaking test coverage a little

  • Loading branch information...
1 parent 71a1038 commit b2e881ee0a4e75e07a358c5bf38ba4cfa5f5c0ff harrisj committed Jun 7, 2008
Showing with 12 additions and 1 deletion.
  1. +3 −1 test/test_dbslayer_adapter.rb
  2. +9 −0 test/test_dbslayer_results.rb
@@ -16,7 +16,8 @@ def test_active?
end
def test_active_fail?
-
+ @adapter.raw_connection.expects(:mysql_stats).raises(RuntimeError)
+ assert_equal false, @adapter.active?
end
def test_select_rows
@@ -45,6 +46,7 @@ def test_update_affected_rows
assert_equal 42, affected_rows
end
+
def test_tables
@adapter.raw_connection.expects(:cmd_execute).with(:db, sql_hash("SHOW TABLES")).returns(SHOW_TABLES_REPLY)
tables = @adapter.tables
@@ -34,6 +34,15 @@ def test_success?
assert !@result.success?
end
+ def test_num_rows_nil
+ @result = ActiveRecord::ConnectionAdapters::DbslayerResult.new({})
+ assert_equal 0, @result.num_rows
+ end
+
+ def test_num_rows
+ assert_equal 10, @result.num_rows
+ end
+
def test_hash_rows
assert_equal CITY_HASH_ROWS, @result.hash_rows
end

0 comments on commit b2e881e

Please sign in to comment.