Permalink
Browse files

Add spec coverage of SQL::Expression#sql_literal

  • Loading branch information...
1 parent f439fc1 commit 917dc3cde17df89cf8efb132751a293d334c4459 @jeremyevans committed Nov 20, 2009
Showing with 7 additions and 0 deletions.
  1. +7 −0 spec/core/expression_filters_spec.rb
View
7 spec/core/expression_filters_spec.rb
@@ -399,6 +399,13 @@ def @d.lit(*args)
y.lit.should == y
end
+ it "should return have .sql_literal operate like .to_s" do
+ y = :x + 1
+ y.sql_literal(@d).should == '(x + 1)'
+ y.sql_literal(@d).should == y.to_s(@d)
+ y.sql_literal(@d).should == @d.literal(y)
+ end
+
it "should raise an error if trying to create an invalid complex expression" do
proc{Sequel::SQL::ComplexExpression.new(:BANG, 1, 2)}.should raise_error(Sequel::Error)
end

0 comments on commit 917dc3c

Please sign in to comment.