aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql2/quoting_test.rb
blob: a49cbba4b4bd38b2fd4bd8793f24b186f2e9f48c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require "cases/helper"

class Mysql2QuotingTest < ActiveRecord::Mysql2TestCase
  setup do
    @connection = ActiveRecord::Base.connection
  end

  test 'quoted date precision for gte 5.6.4' do
    @connection.stubs(:full_version).returns('5.6.4')
    @connection.remove_instance_variable(:@version)
    t = Time.now.change(usec: 1)
    assert_match(/\.000001\z/, @connection.quoted_date(t))
  end

  test 'quoted date precision for lt 5.6.4' do
    @connection.stubs(:full_version).returns('5.6.3')
    @connection.remove_instance_variable(:@version)
    t = Time.now.change(usec: 1)
    refute_match(/\.000001\z/, @connection.quoted_date(t))
  end
end