Skip to content

Commit

Permalink
Test which checks the error being raised by #unsupported in ToSql Vis…
Browse files Browse the repository at this point in the history
…itor
  • Loading branch information
brocktimus committed May 27, 2014
1 parent e7f0cbb commit c28e9ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/visitors/test_to_sql.rb
Expand Up @@ -247,6 +247,12 @@ def dispatch
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")'
Expand Down

3 comments on commit c28e9ef

@codeodor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why shouldn't it raise an ArgumentError?

@brocktimus
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, my test name is bad. The reason it shouldn't have raised an ArgumentError is because that error was being raised due to a method signature mismatch, not by intention / checking things. PR where it was merged (#276) shows discussion / other commits. The assertion has been changed to check the message at least.

Can detail more there if you want.

@codeodor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, thank you so much for pointing me to the pull request! I was just curious as to why, since it seemed like argument error was a natural fit. I was interested because I just opened #369 to adjust the message somewhat.

Thank you!

Please sign in to comment.