Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
test to reproduce stack level too deep in mongo_mapper
require 'test_helper'
require 'models'
class StackLevelTooDeepTest < Test::Unit::TestCase
def setup
@klass = Doc('Person') do
key :name, String
end
@pet_klass = EDoc('Pet') do
key :name, String
end
@klass.many :pets, :class => @pet_klass
@address_class = EDoc('Address') do
key :city, String
key :state, String
end
end
should "be able to save many embedded documents" do
setup
person = @klass.create
1000.times do
person.pets << @pet_klass.new(:name => 'sparky')
end
failed = false
begin
person.save
rescue SystemStackError => e
failed = true
#silently swallow up error...
end
person.reload
person.should_not be_new
person.pets.count.should == 1000
person.pets.last.should_not be_new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.