Sha256: b7e5c9ad52f6cf3150c94e4e771e9b2dba9e1bcc12ecf386b08720b670bc9ab8
Contents?: true
Size: 969 Bytes
Versions: 1
Compression:
Stored size: 969 Bytes
Contents
require File.join(File.dirname(__FILE__), 'helper') class AdapterTest < Test::Unit::TestCase context 'Resource' do setup do class ::User include DataMapper::Resource property :id, Serial property :name, String property :age, Integer end @user = User.create(:name => 'Joe', :age => 22) end teardown do # Why doesn't DM::Resource#destroy exist? repository = DataMapper.repository(:default) repository.adapter.delete( DataMapper::Query.new(repository, ::User, {}) ) end should 'assign id to attributes' do item = User.create assert_kind_of User, item assert_not_nil item.id end should 'get an item' do assert_equal @user, User.get(@user.id) end should 'get items' do assert_equal 1, User.all.size end should 'destroy item' do assert @user.destroy assert_equal 0, User.all.size end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shanna-dm-tokyo-cabinet-adapter-0.1.1 | test/test_adapter.rb |