aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@squareup.com>2014-09-24 19:01:33 -0700
committerTamir Duberstein <tamird@squareup.com>2014-09-25 13:30:03 -0700
commitfef9ce493ec3eab3cf120550abd0257f89eaddf7 (patch)
tree6f607b2c312db046a488629f39bd8755b4cbc5c9 /test
parentb57a11cb8abfca345f63084ce841c6f412c1156e (diff)
downloadrails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.tar.gz
rails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.tar.bz2
rails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.zip
{Matches,DoesNotMatch} support the ESCAPE clause
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_to_sql.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index 195566902b..abd8cfe356 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -312,6 +312,13 @@ module Arel
}
end
+ it "can handle ESCAPE" do
+ node = @table[:name].matches('foo!%', '!')
+ compile(node).must_be_like %{
+ "users"."name" LIKE 'foo!%' ESCAPE '!'
+ }
+ end
+
it 'can handle subqueries' do
subquery = @table.project(:id).where(@table[:name].matches('foo%'))
node = @attr.in subquery
@@ -329,6 +336,13 @@ module Arel
}
end
+ it "can handle ESCAPE" do
+ node = @table[:name].does_not_match('foo!%', '!')
+ compile(node).must_be_like %{
+ "users"."name" NOT LIKE 'foo!%' ESCAPE '!'
+ }
+ end
+
it 'can handle subqueries' do
subquery = @table.project(:id).where(@table[:name].does_not_match('foo%'))
node = @attr.in subquery