diff options
Diffstat (limited to 'test/visitors')
-rw-r--r-- | test/visitors/test_postgres.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/visitors/test_postgres.rb b/test/visitors/test_postgres.rb index d00aa1c100..e6fd4cd0da 100644 --- a/test/visitors/test_postgres.rb +++ b/test/visitors/test_postgres.rb @@ -120,6 +120,13 @@ module Arel } end + it "can handle case insensitive" do + node = Arel::Nodes::Regexp.new(@table[:name], Nodes.build_quoted('foo%'), false) + compile(node).must_be_like %{ + "users"."name" ~* 'foo%' + } + end + it 'can handle subqueries' do subquery = @table.project(:id).where(Arel::Nodes::Regexp.new(@table[:name], Nodes.build_quoted('foo%'))) node = @attr.in subquery @@ -137,6 +144,13 @@ module Arel } end + it "can handle case insensitive" do + node = Arel::Nodes::NotRegexp.new(@table[:name], Nodes.build_quoted('foo%'), false) + compile(node).must_be_like %{ + "users"."name" !~* 'foo%' + } + end + it 'can handle subqueries' do subquery = @table.project(:id).where(Arel::Nodes::NotRegexp.new(@table[:name], Nodes.build_quoted('foo%'))) node = @attr.in subquery |