Sha256: a094d7f5b30ca5edbac867a1d7bc32ac8316c732a871ae4e6ee9546139b54f40

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

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

describe DataMapper::Types::URI do
  before(:all) do
    class URITest
      include DataMapper::Resource

      property :id, Integer, :serial => true
      property :uri, DM::URI
    end
    URITest.auto_migrate!
  end

  it "should work" do
    repository(:default) do
      URITest.create!(:uri => 'http://localhost')
    end

    URITest.first.uri.should == Addressable::URI.parse('http://localhost')
  end

  it 'should immediately typecast supplied values' do
    URITest.new(:uri => 'http://localhost').uri.should == Addressable::URI.parse('http://localhost')
  end

  it "should correctly typecast nil values" do
    URITest.new(:uri => nil).uri.should == nil
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-types-0.9.6 spec/integration/uri_spec.rb
dm-types-0.9.7 spec/integration/uri_spec.rb