Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing tests to deal with data differences between prepared statement…

…s and non-prepared statements
  • Loading branch information...
commit f7ef7caac634eba23fb339a5bcfe4734e216d04d 1 parent 8f43230
@tenderlove tenderlove authored
View
5 activerecord/test/cases/adapters/mysql/connection_test.rb
@@ -70,11 +70,14 @@ def test_exec_no_binds
assert_equal %w{ id data }, result.columns
@connection.exec_query('INSERT INTO ex (id, data) VALUES (1, "foo")')
+
+ # if there are no bind parameters, it will return a string (due to
+ # the libmysql api)
result = @connection.exec_query('SELECT id, data FROM ex')
assert_equal 1, result.rows.length
assert_equal 2, result.columns.length
- assert_equal [[1, 'foo']], result.rows
+ assert_equal [['1', 'foo']], result.rows
end
def test_exec_with_binds
View
4 activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
@@ -30,7 +30,9 @@ def test_exec_insert_number
result = @conn.exec_query('SELECT number FROM ex WHERE number = 10')
assert_equal 1, result.rows.length
- assert_equal 10, result.rows.last.last
+ # if there are no bind parameters, it will return a string (due to
+ # the libmysql api)
+ assert_equal '10', result.rows.last.last
end
def test_exec_insert_string
View
2  activerecord/test/cases/query_cache_test.rb
@@ -156,7 +156,7 @@ def test_cache_does_not_wrap_string_results_in_arrays
# Oracle adapter returns count() as Fixnum or Float
if current_adapter?(:OracleAdapter)
assert_kind_of Numeric, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks")
- elsif current_adapter?(:SQLite3Adapter) && sqlite3_version > '1.2.5' || current_adapter?(:Mysql2Adapter) || current_adapter?(:MysqlAdapter)
+ elsif current_adapter?(:SQLite3Adapter) && sqlite3_version > '1.2.5' || current_adapter?(:Mysql2Adapter)
# Future versions of the sqlite3 adapter will return numeric
assert_instance_of Fixnum,
Task.connection.select_value("SELECT count(*) AS count_all FROM tasks")
Please sign in to comment.
Something went wrong with that request. Please try again.