Namespace
Methods
T
Instance Public methods
test_dates_and_times()
# File activerecord/test/cases/quoting_test.rb, line 120
def test_dates_and_times
  @quoter.extend(Module.new { def quoted_date(value) 'lol' end
test_quote_bigdecimal()
# File activerecord/test/cases/quoting_test.rb, line 115
def test_quote_bigdecimal
  bigdec = BigDecimal.new((1 << 100).to_s)
  assert_equal bigdec.to_s('F'), @quoter.quote(bigdec, nil)
end
test_quote_bignum()
# File activerecord/test/cases/quoting_test.rb, line 110
def test_quote_bignum
  bignum = 1 << 100
  assert_equal bignum.to_s, @quoter.quote(bignum, nil)
end
test_quote_false()
# File activerecord/test/cases/quoting_test.rb, line 96
def test_quote_false
  assert_equal @quoter.quoted_false, @quoter.quote(false, nil)
end
test_quote_fixnum()
# File activerecord/test/cases/quoting_test.rb, line 105
def test_quote_fixnum
  fixnum = 1
  assert_equal fixnum.to_s, @quoter.quote(fixnum, nil)
end
test_quote_float()
# File activerecord/test/cases/quoting_test.rb, line 100
def test_quote_float
  float = 1.2
  assert_equal float.to_s, @quoter.quote(float, nil)
end
test_quote_nil()
# File activerecord/test/cases/quoting_test.rb, line 88
def test_quote_nil
  assert_equal 'NULL', @quoter.quote(nil, nil)
end
test_quote_string()
# File activerecord/test/cases/quoting_test.rb, line 35
def test_quote_string
  assert_equal "''", @quoter.quote_string("'")
  assert_equal "\\\\", @quoter.quote_string("\\")
  assert_equal "hi''i", @quoter.quote_string("hi'i")
  assert_equal "hi\\\\i", @quoter.quote_string("hi\\i")
end
test_quote_true()
# File activerecord/test/cases/quoting_test.rb, line 92
def test_quote_true
  assert_equal @quoter.quoted_true, @quoter.quote(true, nil)
end
test_quote_with_quoted_id()
# File activerecord/test/cases/quoting_test.rb, line 84
def test_quote_with_quoted_id
  assert_equal 1, @quoter.quote(Struct.new(:quoted_id).new(1), nil)
end
test_quoted_date()
# File activerecord/test/cases/quoting_test.rb, line 42
def test_quoted_date
  t = Date.today
  assert_equal t.to_s(:db), @quoter.quoted_date(t)
end
test_quoted_datetime_local()

DateTime doesn't define getlocal, so make sure it does nothing

# File activerecord/test/cases/quoting_test.rb, line 77
def test_quoted_datetime_local
  with_timezone_config default: :local do
    t = DateTime.now
    assert_equal t.to_s(:db), @quoter.quoted_date(t)
  end
end
test_quoted_datetime_utc()
# File activerecord/test/cases/quoting_test.rb, line 68
def test_quoted_datetime_utc
  with_timezone_config default: :utc do
    t = DateTime.now
    assert_equal t.getutc.to_s(:db), @quoter.quoted_date(t)
  end
end
test_quoted_time_crazy()
# File activerecord/test/cases/quoting_test.rb, line 61
def test_quoted_time_crazy
  with_timezone_config default: :asdfasdf do
    t = Time.now
    assert_equal t.getlocal.to_s(:db), @quoter.quoted_date(t)
  end
end
test_quoted_time_local()
# File activerecord/test/cases/quoting_test.rb, line 54
def test_quoted_time_local
  with_timezone_config default: :local do
    t = Time.now
    assert_equal t.getlocal.to_s(:db), @quoter.quoted_date(t)
  end
end
test_quoted_time_utc()
# File activerecord/test/cases/quoting_test.rb, line 47
def test_quoted_time_utc
  with_timezone_config default: :utc do
    t = Time.now
    assert_equal t.getutc.to_s(:db), @quoter.quoted_date(t)
  end
end