Permalink
Browse files

backporting beda2d4 for newer sqlite-ruby bindings

Signed-off-by: Xavier Noria <fxn@hashref.com>
  • Loading branch information...
1 parent 25ec613 commit a637b5f4471be6b7284673fc7196308afb265e1d @tenderlove tenderlove committed with fxn May 22, 2010
Showing with 8 additions and 2 deletions.
  1. +1 −1 activerecord/test/cases/calculations_test.rb
  2. +7 −1 activerecord/test/cases/query_cache_test.rb
@@ -297,7 +297,7 @@ def test_count_with_scoped_has_many_through_association
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
@@ -49,8 +49,14 @@ def test_cache_is_flat
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

0 comments on commit a637b5f

Please sign in to comment.