Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query cache test #1400

Merged
merged 1 commit into from May 31, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions activerecord/test/cases/query_cache_test.rb
Expand Up @@ -51,16 +51,23 @@ def test_cache_is_flat
end

def test_cache_does_not_wrap_string_results_in_arrays
require 'sqlite3/version' if current_adapter?(:SQLite3Adapter)
require 'sqlite3/version' if current_adapter?(:SQLite3Adapter) && !(RUBY_PLATFORM =~ /java/)

Task.cache do
# 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' or current_adapter?(:Mysql2Adapter)
elsif !(RUBY_PLATFORM =~ /java/) &&
((current_adapter?(:SQLite3Adapter) && SQLite3::VERSION > '1.2.5') or
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")
elsif (RUBY_PLATFORM =~ /java/) &&
((current_adapter?(:SQLite3Adapter)) or
current_adapter?(:MysqlAdapter))
assert_instance_of Fixnum,
Task.connection.select_value("SELECT count(*) AS count_all FROM tasks")
else
assert_instance_of String, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks")
end
Expand Down