Skip to content

Instantly share code, notes, and snippets.

View solnic's full-sized avatar

Peter Solnica solnic

View GitHub Profile
#!/usr/bin/env ruby
#
# encoding: utf-8
require 'dm-sqlite-adapter'
require 'dm-migrations'
require 'dm-validations'
DataMapper.setup :default, "sqlite::memory:"
require 'rubygems'
require 'dm-core'
require 'dm-migrations'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, "sqlite::memory")
class User
include DataMapper::Resource
constraints(:url => 'foo') do
constraints(:mode => 'bar') do
# won't work b/c params are == {} ...
match "/" => redirect { |params, request| "/blah/#{params[:id]}" }
# so I have to do:
match "/" => redirect { |params, request| "/blah/#{request.params[:id]}" }
#!/usr/bin/env ruby
#
# encoding: utf-8
require 'dm-sqlite-adapter'
require 'dm-migrations'
require 'dm-validations'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup :default, "sqlite::memory:"
@solnic
solnic / dm_property_2.0.rb
Created January 18, 2011 12:12
An introduction to DataMapper Property API v. 2.0 (draft)
##
#
# The most important aspect of the new Property API is that
# property inheritance should not be used to instruct
# adapters how to persist data. It means, for example, that
# you should not use Integer as the base class for your custom
# property just because it is persisted as an integer. Right now
# Enum inherits from Integer because it is stored as an integer.
# It is a mistake, because a value of Enum property can be either
# a string or a symbol, not integer. The fact that it is persisted
require 'rubygems'
gem 'dm-core', '0.10.2'
gem 'dm-migrations', '0.10.2'
gem 'dm-timestamps', '0.10.2'
require 'dm-core'
require 'dm-migrations'
require 'dm-timestamps'
1)
'DataMapper::Adapters::MysqlAdapter#create serial properties should not send NULL values' FAILED
expected: /\AINSERT INTO `articles` \(\) VALUES \(\)\z/,
got: "com.mysql.jdbc.JDBC4PreparedStatement@18a4622: INSERT INTO `articles` () VALUES ()" (using =~)
/home/solnic/workspace/dm/dm-do-adapter/lib/dm-do-adapter/spec/shared_spec.rb:72:
2)
'DataMapper::Adapters::MysqlAdapter#create properties without a default should not send NULL values' FAILED
expected: /^INSERT INTO `articles` \(`id`\) VALUES \(.{1,2}\)$/i,
got: "com.mysql.jdbc.JDBC4PreparedStatement@12af08b: INSERT INTO `articles` (`id`) VALUES (1)" (using =~)

dm-core

RUBY in_memory yaml sqlite postgres mysql
1.8.7 pass pass pass pass pass
1.9.2 pass pass pass pass pass
jruby pass pass pass pass pass

dm-active_model

RUBY in_memory yaml sqlite postgres mysql
NameError in 'DataMapper::Timestamp with default adapter timestamps helper inclusion should fail on empty arguments'
undefined method `proxied_by_rspec__now' for #<Class:DateTime>
kernel/common/module.rb:266:in `instance_method'
kernel/common/module.rb:195:in `remove_method'
kernel/bootstrap/array.rb:71:in `each'
kernel/common/module.rb:192:in `remove_method'
/home/solnic/.rvm/gems/rbx-head/gems/rspec-1.3.1/lib/spec/mocks/proxy.rb:239:in `reset_proxied_method'
kernel/common/eval.rb:164:in `instance_eval'
/home/solnic/.rvm/gems/rbx-head/gems/rspec-1.3.1/lib/spec/mocks/proxy.rb:235:in `reset_proxied_method'
/home/solnic/.rvm/gems/rbx-head/gems/rspec-1.3.1/lib/spec/mocks/proxy.rb:230:in `reset_proxied_methods'
require 'dm-migrations'
require 'dm-types'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, "mysql://root@localhost/test")
class A
include DataMapper::Resource
storage_names[:default] = 'A'
property :id, Serial