From 955a9fa51293eb2f52522db2e73f60f76b9becd4 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 22 May 2010 14:18:41 -0400 Subject: [PATCH] backporting beda2d43 for newer sqlite-ruby bindings --- activerecord/test/cases/calculations_test.rb | 2 +- activerecord/test/cases/query_cache_test.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 60f41a8..503b70a 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -297,7 +297,7 @@ class CalculationsTest < ActiveRecord::TestCase end def test_should_sum_expression - assert_equal '636', Account.sum("2 * credit_limit") + assert_equal 636, Account.sum("2 * credit_limit").to_i end def test_count_with_from_option diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index f90a66d..f7f9777 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -49,8 +49,14 @@ class QueryCacheTest < ActiveRecord::TestCase end def test_cache_does_not_wrap_string_results_in_arrays + require 'sqlite3/version' if current_adapter?(:SQLite3Adapter) + Task.cache do - assert_instance_of String, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks") + if current_adapter?(:SQLite3Adapter) && SQLite3::Version::VERSION > '1.2.5' + 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 end end end -- 1.7.0.6