Sha256: 586dbed89285c25d85315b834a23809d9a2f1093187e72e2e5047fa9ef7c7660

Contents?: true

Size: 636 Bytes

Versions: 4

Compression:

Stored size: 636 Bytes

Contents

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

describe DataMapper::Types::FilePath do
  before(:all) do
    class FilePathTest
      include DataMapper::Resource

      property :id, Integer, :serial => true
      property :path, FilePath
    end
    FilePathTest.auto_migrate!
  end

  it "should work" do
    repository(:default) do
      FilePathTest.create!(:path => '/usr')
    end

    FilePathTest.first.path.should == Pathname.new('/usr')
  end

  it 'should immediately typecast supplied values' do
    FilePathTest.new(:path => '/usr').path.should == Pathname.new('/usr')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dm-types-0.9.6 spec/integration/file_path_spec.rb
dm-types-0.9.4 spec/integration/file_path_spec.rb
dm-types-0.9.5 spec/integration/file_path_spec.rb
dm-types-0.9.7 spec/integration/file_path_spec.rb