Sha256: ed521058e1468e8c3304faf29408d67ecb544eab566b0a693d7168652517f360

Contents?: true

Size: 671 Bytes

Versions: 8

Compression:

Stored size: 671 Bytes

Contents

require "cases/helper"
require "ipaddr"

module ActiveRecord
  module ConnectionAdapters
    class PostgreSQLAdapter < AbstractAdapter
      class CidrTest < ActiveRecord::PostgreSQLTestCase
        test "type casting IPAddr for database" do
          type = OID::Cidr.new
          ip = IPAddr.new("255.0.0.0/8")
          ip2 = IPAddr.new("127.0.0.1")

          assert_equal "255.0.0.0/8", type.serialize(ip)
          assert_equal "127.0.0.1/32", type.serialize(ip2)
        end

        test "casting does nothing with non-IPAddr objects" do
          type = OID::Cidr.new

          assert_equal "foo", type.serialize("foo")
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ibm_db-5.2.0 test/cases/adapters/postgresql/cidr_test.rb
ibm_db-5.1.0 test/cases/adapters/postgresql/cidr_test.rb
ibm_db-5.0.5 test/cases/adapters/postgresql/cidr_test.rb
ibm_db-5.0.4 test/cases/adapters/postgresql/cidr_test.rb
ibm_db-5.0.3 test/cases/adapters/postgresql/cidr_test.rb
ibm_db-5.0.2 test/cases/adapters/postgresql/cidr_test.rb
ibm_db-4.0.0-x86-mingw32 test/cases/adapters/postgresql/cidr_test.rb
ibm_db-4.0.0 test/cases/adapters/postgresql/cidr_test.rb