diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-09-02 01:35:49 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-02 01:35:49 +0900 |
commit | 0eb9a8e251dc58b1a829935713037b1163c87062 (patch) | |
tree | a43fa317530376c1b02e06e2158d633a5592d9f0 | |
parent | 806f96ceaecbf9cf8d2fdbbdaf1fb2a499769cbf (diff) | |
parent | cb2934ed79286f46c1e5593dd4c34aebfb2bc4d6 (diff) | |
download | rails-0eb9a8e251dc58b1a829935713037b1163c87062.tar.gz rails-0eb9a8e251dc58b1a829935713037b1163c87062.tar.bz2 rails-0eb9a8e251dc58b1a829935713037b1163c87062.zip |
Merge pull request #30499 from yahonda/diag_float
Remove unnecessary `to_i` for old sqlite3 adapter
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/query_cache_test.rb | 10 |
2 files changed, 4 insertions, 9 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 39dff19b78..b47fd0af41 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -518,8 +518,7 @@ class CalculationsTest < ActiveRecord::TestCase end def test_should_sum_expression - # Oracle adapter returns floating point value 636.0 after SUM - if current_adapter?(:OracleAdapter) + if current_adapter?(:SQLite3Adapter, :Mysql2Adapter, :PostgreSQLAdapter, :OracleAdapter) assert_equal 636, Account.sum("2 * credit_limit") else assert_equal 636, Account.sum("2 * credit_limit").to_i diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index d3f4b5bf75..5cb537b623 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -302,14 +302,10 @@ class QueryCacheTest < ActiveRecord::TestCase end end - def test_cache_does_not_wrap_string_results_in_arrays + def test_cache_does_not_wrap_results_in_arrays Task.cache do - # Oracle adapter returns count() as Integer 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, :Mysql2Adapter, :PostgreSQLAdapter) - # Future versions of the sqlite3 adapter will return numeric - assert_instance_of 0.class, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks") + if current_adapter?(:SQLite3Adapter, :Mysql2Adapter, :PostgreSQLAdapter, :OracleAdapter) + assert_equal 2, 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 |