From c28e9efde7e0c384b5f959e6eb48fa47d073227e Mon Sep 17 00:00:00 2001 From: Brock Trappitt Date: Tue, 27 May 2014 09:16:28 +0800 Subject: Test which checks the error being raised by #unsupported in ToSql Visitor --- test/visitors/test_to_sql.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index 05e75b5e0d..5d5a351737 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -247,6 +247,12 @@ module Arel compile(Nodes.build_quoted(nil)).must_be_like "NULL" end + it "unsupported input should not raise ArgumentError" do + assert_raises(RuntimeError) do + compile(nil) + end + 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")' -- cgit v1.2.3 From b1bf89cb77b05e9c38fc922e796caa47daa3af86 Mon Sep 17 00:00:00 2001 From: Brock Trappitt Date: Wed, 28 May 2014 08:28:54 +0800 Subject: Asserting on error message --- test/visitors/test_to_sql.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index 5d5a351737..65d36bc004 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -248,9 +248,8 @@ module Arel end it "unsupported input should not raise ArgumentError" do - assert_raises(RuntimeError) do - compile(nil) - end + error = assert_raises(RuntimeError) { compile(nil) } + assert_match /\Aunsupported/, error.message end it "should visit_Arel_SelectManager, which is a subquery" do -- cgit v1.2.3