diff options
author | Matthew Draper <matthew@trebex.net> | 2014-09-26 08:21:01 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-09-26 08:21:01 +0930 |
commit | cdae8216f582e035370b84edd236af7d22702e75 (patch) | |
tree | 6f607b2c312db046a488629f39bd8755b4cbc5c9 /test/visitors/test_to_sql.rb | |
parent | b57a11cb8abfca345f63084ce841c6f412c1156e (diff) | |
parent | fef9ce493ec3eab3cf120550abd0257f89eaddf7 (diff) | |
download | rails-cdae8216f582e035370b84edd236af7d22702e75.tar.gz rails-cdae8216f582e035370b84edd236af7d22702e75.tar.bz2 rails-cdae8216f582e035370b84edd236af7d22702e75.zip |
Merge pull request #318 from tamird/match-escape
{Matches,DoesNotMatch} support the ESCAPE clause
Diffstat (limited to 'test/visitors/test_to_sql.rb')
-rw-r--r-- | test/visitors/test_to_sql.rb | 14 |
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 |