Skip to content

Instantly share code, notes, and snippets.

View dbussink's full-sized avatar

Dirkjan Bussink dbussink

View GitHub Profile
diff --git a/rakelib/vm.rake b/rakelib/vm.rake
index f085e52..415c551 100644
--- a/rakelib/vm.rake
+++ b/rakelib/vm.rake
@@ -38,7 +38,7 @@ dep_file = "vm/.depends.mf"
vm_objs = %w[ vm/drivers/cli.o ]
vm_srcs = %w[ vm/drivers/cli.cpp ]
EX_INC = %w[ libtommath onig libffi/include
- libbstring libmquark libmpa libcchash
+ libbstring libcchash libmquark libmpa
Running 813 tests.......................................
In TestBignum::test_normalize:
./vm/test/test_bignum.hpp:165: Error: Expected (b1 == Bignum::normalize(state, b1)), found ({ 48 4E 4B 01 00 00 00 00 } != { FD FF FF FF 01 00 00 00 })
...........................................
In TestBignum::test_coerce_fixnum:
./vm/test/test_bignum.hpp:665: Error: Assertion failed: c
...........................................................................................................................................................
In TestFixnum::test_coerce_bignum:
./vm/test/test_fixnum.hpp:526: Error: Assertion failed: c
.........................................................................
clock_gettime(CLOCK_MONOTONIC, {351471, 759424769}) = 0
clock_gettime(CLOCK_REALTIME, {1224620178, 448346218}) = 0
read(7, "$: << \"#{Dir.pwd}/lib\"\n\nclass Ex"..., 32383) = 5904
epoll_ctl(3, EPOLL_CTL_ADD, 7, {EPOLLIN, {u32=7, u64=7}}) = -1 EPERM (Operation not permitted)
clock_gettime(CLOCK_MONOTONIC, {351471, 774647311}) = 0
epoll_wait(3,
=== LONG WAIT ===
share_examples_for 'A Resource' do
before do
%w[ @article ].each do |ivar|
raise "+#{ivar}+ should be defined in before block" unless instance_variable_get(ivar)
end
end
it 'should respond to #save' do
@article.should respond_to(:save)
end
describe 'with new resources in a has relationship' do
it 'should save the new resources'
it 'should ensure all new resources have the proper foreign key'
end
describe 'with dirty resources in a has relationship' do
@first_comment = @user.comments.create(:body => "DM is great!")
@second_comment = @child_model.create(:user => @user, :body => "is it really?")
@first_comment.body = "It still has rough edges"
@second_comment.body = "But these cool specs help fixing that"
@second_comment.user = @model.create(:name => 'dkubb')
@return = @user.save
@first_comment = @user.comments.build(:body => "DM is great!")
@second_comment = @child_model.new(:user => @user, :body => "is it really?")
p @user.comments.size
diff --git a/lib/extlib/lazy_array.rb b/lib/extlib/lazy_array.rb
index 091559d..12e3922 100644
--- a/lib/extlib/lazy_array.rb
+++ b/lib/extlib/lazy_array.rb
@@ -4,10 +4,9 @@ class LazyArray # borrowed partially from StrokeDB
include Enumerable
# these methods should return self or nil
- RETURN_SELF = [ :<<, :clear, :concat, :collect!, :delete_if,
+ RETURN_SELF = [ :clear, :concat, :collect!, :delete_if,
diff --git a/lib/dm-core/collection.rb b/lib/dm-core/collection.rb
index b58b6fe..3b9fdc3 100644
--- a/lib/dm-core/collection.rb
+++ b/lib/dm-core/collection.rb
@@ -166,6 +166,8 @@ module DataMapper
if loaded? && args.empty?
return relate_resource(super)
+ elsif !loaded? && !args.last.respond_to?(:merge) && lazy_possible?(head, *args)
+ return head.first(*args)
1)
DataMapper::Associations::UnsavedParentError in 'DataMapper::Associations::OneToMany::Proxy should respond to #<<'
The parent must be saved before mass-deleting the association without validation
/Users/dirkjan/Documents/projects/dm-core-spec/lib/dm-core/associations/one_to_many.rb:309:in `destroy!'
./spec/public/associations/one_to_many_spec.rb:71: