aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKazuya NUMATA <numata@gmail.com>2014-12-25 12:58:42 +0900
committerKazuya NUMATA <numata@gmail.com>2014-12-25 12:58:42 +0900
commit2c95c39e9345ef50a7e9c3ad573857b1d358e04a (patch)
treeb838d8bece807bb34684f6999065d0a6543d0726 /test
parent0cd5fa9671592a16ee34f0718704b15f27911620 (diff)
downloadrails-2c95c39e9345ef50a7e9c3ad573857b1d358e04a.tar.gz
rails-2c95c39e9345ef50a7e9c3ad573857b1d358e04a.tar.bz2
rails-2c95c39e9345ef50a7e9c3ad573857b1d358e04a.zip
{Matches,DoesNotMatch} support the ESCAPE clause with PostgreSQL
to_SQL already has supported the ESCAPE clause in #318. PostgreSQL can use the ESCAPE clause too.
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_postgres.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/visitors/test_postgres.rb b/test/visitors/test_postgres.rb
index 368feb5977..d6de216d91 100644
--- a/test/visitors/test_postgres.rb
+++ b/test/visitors/test_postgres.rb
@@ -58,6 +58,13 @@ module Arel
}
end
+ it "can handle ESCAPE" do
+ node = @table[:name].matches('foo!%', '!')
+ compile(node).must_be_like %{
+ "users"."name" ILIKE 'foo!%' ESCAPE '!'
+ }
+ end
+
it 'can handle subqueries' do
subquery = @table.project(:id).where(@table[:name].matches('foo%'))
node = @attr.in subquery
@@ -75,6 +82,13 @@ module Arel
}
end
+ it "can handle ESCAPE" do
+ node = @table[:name].does_not_match('foo!%', '!')
+ compile(node).must_be_like %{
+ "users"."name" NOT ILIKE 'foo!%' ESCAPE '!'
+ }
+ end
+
it 'can handle subqueries' do
subquery = @table.project(:id).where(@table[:name].does_not_match('foo%'))
node = @attr.in subquery