Skip to content

Commit

Permalink
Fixed failing spec in mongoid 3, parent_id column should not be of ty…
Browse files Browse the repository at this point in the history
…pe Integer but BSON::ObjectId
  • Loading branch information
jbbarth committed May 31, 2012
1 parent c5fbaea commit d13df14
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/lib/ancestry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/mongoid-ancestry/class_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
2 changes: 1 addition & 1 deletion spec/support/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d13df14

Please sign in to comment.