diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-14 10:44:39 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-14 10:44:39 -0700 |
commit | ae61c03891e2190620fb15b8f4c833ebf6993dc1 (patch) | |
tree | 2e92296c7c603b18e23485f7d9d191376a8c4190 /activerecord/test/cases | |
parent | 4e8cf43ff9e642ba5ef0dd0f54e5eb2409e160ca (diff) | |
parent | 6f400dabf79faedec258963a6b37b7614f5d4902 (diff) | |
download | rails-ae61c03891e2190620fb15b8f4c833ebf6993dc1.tar.gz rails-ae61c03891e2190620fb15b8f4c833ebf6993dc1.tar.bz2 rails-ae61c03891e2190620fb15b8f4c833ebf6993dc1.zip |
Merge pull request #7942 from IPGlider/master
Fix typo in inet and cidr saving
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/quoting_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/quoting_test.rb b/activerecord/test/cases/adapters/postgresql/quoting_test.rb index f8a605b67c..685f0ea74f 100644 --- a/activerecord/test/cases/adapters/postgresql/quoting_test.rb +++ b/activerecord/test/cases/adapters/postgresql/quoting_test.rb @@ -1,4 +1,5 @@ require "cases/helper" +require 'ipaddr' module ActiveRecord module ConnectionAdapters @@ -20,6 +21,18 @@ module ActiveRecord assert_equal 'f', @conn.type_cast(false, c) end + def test_type_cast_cidr + ip = IPAddr.new('255.0.0.0/8') + c = Column.new(nil, ip, 'cidr') + assert_equal ip, @conn.type_cast(ip, c) + end + + def test_type_cast_inet + ip = IPAddr.new('255.1.0.0/8') + c = Column.new(nil, ip, 'inet') + assert_equal ip, @conn.type_cast(ip, c) + end + def test_quote_float_nan nan = 0.0/0 c = Column.new(nil, 1, 'float') |