Permalink
Browse files

Add some more specs for pg_inet

  • Loading branch information...
1 parent 1710dbb commit 1cbe9bcd5a59fcc52d9a898cbefb7e3a00e92193 @jeremyevans committed May 29, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 spec/extensions/pg_inet_spec.rb
@@ -18,6 +18,12 @@
@db.literal(IPAddr.new('2001:4f8:3:ba:2e0:81ff:fe22:d1f1')).should == "'2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128'"
end unless ipv6_broken
+ it "should not affect literalization of custom objects" do
+ o = Object.new
+ def o.sql_literal(ds) 'v' end
+ @db.literal(o).should == 'v'
+ end
+
it "should support using IPAddr as bound variables" do
@db.bound_variable_arg(1, nil).should == 1
@db.bound_variable_arg(IPAddr.new('127.0.0.1'), nil).should == '127.0.0.1/32'
@@ -33,5 +39,6 @@
@db.typecast_value(:ipaddr, ip).should equal(ip)
@db.typecast_value(:ipaddr, ip.to_s).should == ip
proc{@db.typecast_value(:ipaddr, '')}.should raise_error(Sequel::InvalidValue)
+ proc{@db.typecast_value(:ipaddr, 1)}.should raise_error(Sequel::InvalidValue)
end
end

0 comments on commit 1cbe9bc

Please sign in to comment.