class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::QuotingTest
Public Instance Methods
setup()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/quoting_test.rb, line 9 def setup @conn = ActiveRecord::Base.connection end
test_quote_bit_string()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/quoting_test.rb, line 37 def test_quote_bit_string value = "'); SELECT * FROM users; /*\n01\n*/--" type = OID::Bit.new assert_nil @conn.quote(type.serialize(value)) end
test_quote_float_infinity()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/quoting_test.rb, line 26 def test_quote_float_infinity infinity = 1.0 / 0 assert_equal "'Infinity'", @conn.quote(infinity) end
test_quote_float_nan()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/quoting_test.rb, line 21 def test_quote_float_nan nan = 0.0 / 0 assert_equal "'NaN'", @conn.quote(nan) end
test_quote_range()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/quoting_test.rb, line 31 def test_quote_range range = "1,2]'; SELECT * FROM users; --".."a" type = OID::Range.new(Type::Integer.new, :int8range) assert_equal "'[1,0]'", @conn.quote(type.serialize(range)) end
test_type_cast_false()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/quoting_test.rb, line 17 def test_type_cast_false assert_equal false, @conn.type_cast(false) end
test_type_cast_true()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/quoting_test.rb, line 13 def test_type_cast_true assert_equal true, @conn.type_cast(true) end