diff options
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/quoting_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/range_test.rb | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/quoting_test.rb b/activerecord/test/cases/adapters/postgresql/quoting_test.rb index 59c274c759..11d5173d37 100644 --- a/activerecord/test/cases/adapters/postgresql/quoting_test.rb +++ b/activerecord/test/cases/adapters/postgresql/quoting_test.rb @@ -61,7 +61,7 @@ module ActiveRecord def test_quote_range range = "1,2]'; SELECT * FROM users; --".."a" c = PostgreSQLColumn.new(nil, nil, OID::Range.new(Type::Integer.new, :int8range)) - assert_equal "'[1,2]''; SELECT * FROM users; --,a]'::int8range", @conn.quote(range, c) + assert_equal "'[1,0]'", @conn.quote(range, c) end def test_quote_bit_string diff --git a/activerecord/test/cases/adapters/postgresql/range_test.rb b/activerecord/test/cases/adapters/postgresql/range_test.rb index 02d0a9b483..d812cd01c4 100644 --- a/activerecord/test/cases/adapters/postgresql/range_test.rb +++ b/activerecord/test/cases/adapters/postgresql/range_test.rb @@ -271,12 +271,12 @@ _SQL end def test_ranges_correctly_escape_input - e = assert_raises(ActiveRecord::StatementInvalid) do - range = "1,2]'; SELECT * FROM users; --".."a" - PostgresqlRange.update_all(int8_range: range) - end + range = "-1,2]'; DROP TABLE postgresql_ranges; --".."a" + PostgresqlRange.update_all(int8_range: range) - assert e.message.starts_with?("PG::InvalidTextRepresentation") + assert_nothing_raised do + PostgresqlRange.first + end end private |