Permalink
Browse files

Fixed failing spec in mongoid 3, parent_id column should not be of ty…

…pe Integer but BSON::ObjectId
  • Loading branch information...
1 parent c5fbaea commit d13df1453d37ac96d9b63e051b60165d4b912940 @jbbarth committed May 31, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 spec/lib/ancestry_spec.rb
  2. +1 −1 spec/lib/mongoid-ancestry/class_methods_spec.rb
  3. +1 −1 spec/support/models.rb
@@ -80,7 +80,7 @@
end
it "should have STI support" do
- subject.with_model :extra_columns => {:type => :string} do |model|
+ subject.with_model :extra_columns => {:type => 'String'} do |model|
subclass1 = Object.const_set 'Subclass1', Class.new(model)
(class << subclass1; self; end).send(:define_method, :model_name) do
Struct.new(:human, :underscore).new 'Subclass1', 'subclass1'
@@ -232,7 +232,7 @@ def assert_integrity_restoration model
end
it "should build ancestry from parent ids" do
- subject.with_model :skip_ancestry => true, :extra_columns => {:parent_id => :integer} do |model|
+ subject.with_model :skip_ancestry => true, :extra_columns => {:parent_id => 'BSON::ObjectId'} do |model|
[model.create!].each do |parent1|
(Array.new(5) { model.create :parent_id => parent1.id }).each do |parent2|
(Array.new(5) { model.create :parent_id => parent2.id }).each do |parent3|
@@ -14,7 +14,7 @@ def self.with_model options = {}
TestNode.send(:include, Mongoid::Ancestry) unless skip_ancestry
extra_columns.each do |name, type|
- TestNode.send :field, name, :type => type.to_s.capitalize.constantize
+ TestNode.send :field, name, :type => type.constantize
end unless extra_columns.nil?
TestNode.has_ancestry options unless skip_ancestry

0 comments on commit d13df14

Please sign in to comment.