Sha256: 4723bc05a3c2508161e57c644d951f524c3dfcfe4de1c31e5a2f7205a2a48d32

Contents?: true

Size: 628 Bytes

Versions: 7

Compression:

Stored size: 628 Bytes

Contents

require 'pathname'
require Pathname(__FILE__).dirname.parent.expand_path + 'spec_helper'

describe DataMapper::Types::IPAddress do
  before(:all) do
    class IPAddressTest
      include DataMapper::Resource

      property :id, Serial
      property :ip, IPAddress
    end
    IPAddressTest.auto_migrate!
  end

  it "should work" do
    repository(:default) do
      IPAddressTest.create(:ip => '127.0.0.1')
    end

    IPAddressTest.first.ip.should == IPAddr.new('127.0.0.1')
  end

  it 'should immediately typecast supplied values' do
    IPAddressTest.new(:ip => '10.0.0.1').ip.should == IPAddr.new('10.0.0.1')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dm-types-0.9.3 spec/integration/ip_address_spec.rb
dm-types-0.9.6 spec/integration/ip_address_spec.rb
dm-types-0.9.4 spec/integration/ip_address_spec.rb
dm-types-0.9.5 spec/integration/ip_address_spec.rb
dm-types-0.9.7 spec/integration/ip_address_spec.rb
dm-types-0.9.8 spec/integration/ip_address_spec.rb
dm-types-0.9.9 spec/integration/ip_address_spec.rb