class ActiveRecord::ConnectionAdapters::QuoteARBaseTest

Public Instance Methods

setup() click to toggle source
# File activerecord/test/cases/quoting_test.rb, line 253
def setup
  @time = ::Time.utc(2017, 2, 14, 12, 34, 56, 789999)
  @connection = ActiveRecord::Base.connection
  @connection.create_table :datetime_primary_keys, id: :datetime, precision: 3, force: true
end
teardown() click to toggle source
# File activerecord/test/cases/quoting_test.rb, line 259
def teardown
  @connection.drop_table :datetime_primary_keys, if_exists: true
end
test_quote_ar_object() click to toggle source
# File activerecord/test/cases/quoting_test.rb, line 263
def test_quote_ar_object
  value = DatetimePrimaryKey.new(id: @time)
  assert_equal "'2017-02-14 12:34:56.789000'",  @connection.quote(value)
end
test_type_cast_ar_object() click to toggle source
# File activerecord/test/cases/quoting_test.rb, line 268
def test_type_cast_ar_object
  value = DatetimePrimaryKey.new(id: @time)
  assert_equal @connection.type_cast(value.id),  @connection.type_cast(value)
end