Skip to content

Instantly share code, notes, and snippets.

View myabc's full-sized avatar

Alexander Brandon Coles myabc

  • London, England
  • 04:29 (UTC +01:00)
View GitHub Profile
From b50ff2f453ec40b7e701ec55b08ee5dddffd8c89 Mon Sep 17 00:00:00 2001
From: Alex Coles <alex@alexcolesportfolio.com>
Date: Fri, 26 Feb 2010 16:53:21 +0100
Subject: [PATCH] Rename metaclass to singleton_class
* Reflects rename in commit f863045 in rails/rails (made with no
explanation in commit message, but presumably for good reason).
Signed-off-by: Alex Coles <alex@alexcolesportfolio.com>
---
DataMapper::Resource.module_eval do
def has_attribute?(attribute)
attributes.include?(attribute)
end
end
$LOAD_PATH << 'data_objects/lib'
$LOAD_PATH << 'do_sqlite3/lib'
require "rubygems"
require "dm-core"
#require "dm-validations"
require "spec"
DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'sqlite3:database')
+ %w{files extra_rdoc_files test_files}.each do |accessor|
+ spec.send(accessor).instance_eval { @exclude_procs = Array.new }
+ end
[alexbcoles@mondiale git-repos]$ jruby -S rails -m rails-templates/datamapper.rb recipes-sample-app2
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
create config/locales
create db

RSpec to Bacon Porting Checklist

RSpec Bacon
before :all -
before :each do before do
it { } it 'should ..' do end
require "rubygems"
require "dm-core"
require "dm-migrations"
DataMapper.setup(:default, "mysql://test:@localhost/test")
class Circle
include DataMapper::Resource
diff --git a/data_objects/lib/data_objects/spec/command_spec.rb b/data_objects/lib/data_objects/spec/command_spec.rb
index ad290f6..33554ec 100644
--- a/data_objects/lib/data_objects/spec/command_spec.rb
+++ b/data_objects/lib/data_objects/spec/command_spec.rb
@@ -140,6 +140,12 @@ share_examples_for 'a Command' do
@reader.set_types(String, String, BigDecimal)
lambda { @reader.execute_reader("One parameter") }.should raise_error(ArgumentError, "Field-count mismatch. Expected 3 fields, but the query yielded 2")
end
+
+ it 'should raise an error with an invalid type' do
@myabc
myabc / reduction1.rb
Created November 13, 2009 22:31
Bug Repo: DummyDynamicScope should never be used for backref storage
# Bug Repo: DummyDynamicScope should never be used for backref storage
require 'rubygems'
require 'dm-core'
require 'dm-validations'
nv = DataMapper::Validate::NumericValidator.new("field_name",{})
10.times do # 5.times works
nv.send(:validate_with, :integer, 0, [])
diff --git a/data_objects/lib/data_objects/spec/typecast/string_spec.rb b/data_objects/lib/data_objects/spec/typecast/string_spec.rb
index 4b15afb..f06ef2c 100644
--- a/data_objects/lib/data_objects/spec/typecast/string_spec.rb
+++ b/data_objects/lib/data_objects/spec/typecast/string_spec.rb
@@ -83,4 +83,25 @@ share_examples_for 'supporting String' do
end
+ class StringWithExtraPowers < String; end
+