diff options
Diffstat (limited to 'test/visitors')
-rw-r--r-- | test/visitors/test_dot.rb | 8 | ||||
-rw-r--r-- | test/visitors/test_to_sql.rb | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/test/visitors/test_dot.rb b/test/visitors/test_dot.rb index ee7fc7886c..7763350f5c 100644 --- a/test/visitors/test_dot.rb +++ b/test/visitors/test_dot.rb @@ -17,13 +17,13 @@ module Arel ].each do |klass| define_method("test_#{klass.name.gsub('::', '_')}") do op = klass.new(:a, "z") - @visitor.accept op + @visitor.accept op, Collectors::PlainString.new end end def test_named_function func = Nodes::NamedFunction.new 'omg', 'omg' - @visitor.accept func + @visitor.accept func, Collectors::PlainString.new end # unary ops @@ -41,7 +41,7 @@ module Arel ].each do |klass| define_method("test_#{klass.name.gsub('::', '_')}") do op = klass.new(:a) - @visitor.accept op + @visitor.accept op, Collectors::PlainString.new end end @@ -68,7 +68,7 @@ module Arel ].each do |klass| define_method("test_#{klass.name.gsub('::', '_')}") do binary = klass.new(:a, :b) - @visitor.accept binary + @visitor.accept binary, Collectors::PlainString.new end end end diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index 738bbe9626..c03d89cfef 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -254,6 +254,11 @@ module Arel compile(Nodes.build_quoted(nil)).must_be_like "NULL" end + it "unsupported input should not raise ArgumentError" do + error = assert_raises(RuntimeError) { compile(nil) } + assert_match(/\Aunsupported/, error.message) + end + it "should visit_Arel_SelectManager, which is a subquery" do mgr = Table.new(:foo).project(:bar) compile(mgr).must_be_like '(SELECT bar FROM "foo")' |