Skip to content

Instantly share code, notes, and snippets.

@probablykabari
probablykabari / fix_hooks_in_before_on_non_dirty_resources.patch
Created December 18, 2010 16:53
fixing bug 1372: save method not catching validations on accessors
From feeb8da75a0f6b2dd6d07c53fa4235fef21f050f Mon Sep 17 00:00:00 2001
From: Kabari Hendrick <kabari@gmail.com>
Date: Sat, 18 Dec 2010 10:41:19 -0600
Subject: [PATCH] fixing bug 1372: save method not catching validations on accessors
Signed-off-by: Kabari Hendrick <kabari@gmail.com>
---
lib/dm-core/resource.rb | 5 ++---
lib/dm-core/spec/shared/resource_spec.rb | 5 +++--
@probablykabari
probablykabari / allow-subclassed-model-to-have-different-storage.patch
Created December 14, 2010 06:29
Allow DataMapper::Model descendants to have different storage names and work with auto_upgrade/auto_migrate
From dac3c04bba2898757e0ea7004b49ec7f63894d50 Mon Sep 17 00:00:00 2001
From: Kabari Hendrick <kabari@gmail.com>
Date: Tue, 14 Dec 2010 00:26:54 -0600
Subject: [PATCH] allow subclassesd models to have different storage
Signed-off-by: Kabari Hendrick <kabari@gmail.com>
---
lib/dm-migrations/auto_migration.rb | 6 +-
spec/integration/model_migration_spec.rb | 64 ++++++++++++++++++++++++++++++
@probablykabari
probablykabari / datamapper_lazy_load_patch.patch
Created December 14, 2010 05:22
This fixes lazy loading in Datamapper
From 8e634002d6d79e2c5e2b599e69edd867628364d3 Mon Sep 17 00:00:00 2001
From: Kabari Hendrick <kabari@gmail.com>
Date: Mon, 13 Dec 2010 23:10:33 -0600
Subject: [PATCH] fixing lazy load
Signed-off-by: Kabari Hendrick <kabari@gmail.com>
---
lib/dm-core/model/property.rb | 2 +-
spec/public/property_spec.rb | 14 +++++++++++++-
# line 16
it "should tell you when it receives the right message with the wrong args if you stub the method (fix bug 15719)" do
# NOTE - for whatever reason, if you use a the block style of pending here,
# rcov gets unhappy. Don't know why yet.
m = mock("foo")
m.stub!(:bar)
m.should_receive(:bar).with("message")
lambda {
m.bar("different message")
}.should raise_error(Rspec::Mocks::MockExpectationError, %Q{Mock 'foo' expected :bar with ("message") but received it with ("different message")})
Spec::Runner.configure do |config|
config.before do
repository do |r|
transaction = DataMapper::Transaction.new(r)
transaction.begin
r.adapter.push_transaction(transaction)
end
end
require "dm-core"
require 'dm-migrations'
require "test/unit"
DataMapper.setup(:default, 'sqlite3::memory:')
class Person
include DataMapper::Resource
property :id, Serial
property :name, String
#!/usr/bin/env ruby
#
# A one file test to show count
require 'rubygems'
require 'dm-core'
require 'dm-aggregates'
# setup the logger
DataMapper::Logger.new(STDOUT, :debug)