diff options
author | Arthur Neves <arthurnn@gmail.com> | 2014-03-12 09:06:12 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2014-03-12 09:06:12 -0400 |
commit | 5a934e6787337e51d8174669ea0ca6e0c9ea8081 (patch) | |
tree | 1f68063e92721c15ff346ebb208aafcd918ed656 /activerecord | |
parent | df5a38fc6aeb8dfaa816fcbe0efb3fe4de169833 (diff) | |
download | rails-5a934e6787337e51d8174669ea0ca6e0c9ea8081.tar.gz rails-5a934e6787337e51d8174669ea0ca6e0c9ea8081.tar.bz2 rails-5a934e6787337e51d8174669ea0ca6e0c9ea8081.zip |
Test microsecond on mysql 5.6
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/helper.rb | 5 | ||||
-rw-r--r-- | activerecord/test/schema/schema.rb | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 8a0b0b9589..6acb342d0b 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -212,7 +212,7 @@ class BasicsTest < ActiveRecord::TestCase ) # For adapters which support microsecond resolution. - if current_adapter?(:PostgreSQLAdapter, :SQLite3Adapter) + if current_adapter?(:PostgreSQLAdapter, :SQLite3Adapter) || mysql_56? assert_equal 11, Topic.find(1).written_on.sec assert_equal 223300, Topic.find(1).written_on.usec assert_equal 9900, Topic.find(2).written_on.usec diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 3758224b0c..8a49dfbb44 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -41,6 +41,11 @@ def in_memory_db? ActiveRecord::Base.connection_pool.spec.config[:database] == ":memory:" end +def mysql_56? + current_adapter?(:Mysql2Adapter) && + ActiveRecord::Base.connection.send(:version).join(".") >= "5.6.0" +end + def supports_savepoints? ActiveRecord::Base.connection.supports_savepoints? end diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 5f2d6acbcb..b44e72a67c 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -674,7 +674,11 @@ ActiveRecord::Schema.define do t.string :title t.string :author_name t.string :author_email_address - t.datetime :written_on + if mysql_56? + t.datetime :written_on, limit: 6 + else + t.datetime :written_on + end t.time :bonus_time t.date :last_read # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in |