RSpec
Bacon
before :all
-
before :each do
before do
it { }
it 'should ..' do end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'dm-core' | |
DataMapper::Logger.new(STDOUT, :debug) | |
DataMapper.setup(:default, 'mysql://root:@localhost/test') | |
DataMapper.setup(:logs, "sqlite3:///tmp/test.db") | |
class LoggedEvent | |
include DataMapper::Resource |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b50ff2f453ec40b7e701ec55b08ee5dddffd8c89 Mon Sep 17 00:00:00 2001 | |
From: Alex Coles <[email protected]> | |
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 <[email protected]> | |
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DataMapper::Resource.module_eval do | |
def has_attribute?(attribute) | |
attributes.include?(attribute) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ %w{files extra_rdoc_files test_files}.each do |accessor| | |
+ spec.send(accessor).instance_eval { @exclude_procs = Array.new } | |
+ end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "dm-core" | |
require "dm-migrations" | |
DataMapper.setup(:default, "mysql://test:@localhost/test") | |
class Circle | |
include DataMapper::Resource | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, []) |