Merge branch 'master' into 263-refactoring

This commit is contained in:
Pavel Chipiga 2012-07-25 21:42:48 +03:00
commit 03509e714c
2 changed files with 39 additions and 4 deletions

View File

@ -38,7 +38,7 @@ class Project < ActiveRecord::Base
after_create :attach_to_personal_repository after_create :attach_to_personal_repository
has_ancestry has_ancestry :orphan_strategy => :rootify #:adopt not available yet
include Modules::Models::Owner include Modules::Models::Owner
include Modules::Models::Git include Modules::Models::Git

View File

@ -1,6 +1,41 @@
# -*- encoding : utf-8 -*- # -*- encoding : utf-8 -*-
require 'spec_helper' require 'spec_helper'
#describe Project do describe Project do
# pending "add some examples to (or delete) #{__FILE__}" before(:each) do
stub_symlink_methods
@root_project = FactoryGirl.create(:project)
@child_project = @root_project.fork(FactoryGirl.create(:user))
@child_child_project = @child_project.fork(FactoryGirl.create(:user))
end
context 'for destroy root' do
before(:each) do
@root_project.destroy
end
it "should not be delete child" do
Project.where(:id => @child_project).count.should == 1
end
it "should not be delete child of the child" do
Project.where(:id => @child_child_project).count.should == 1
end
end
# uncommit when will be available :orphan_strategy => :adopt
#context 'for destroy middle node' do
# before(:each) do
# @child_project.destroy
# end # end
# it "should set root project as a parent for orphan child" do
# Project.find(@child_child_project).ancestry == @root_project
# end
# it "should not be delete child of the child" do
# Project.where(:id => @child_child_project).count.should == 1
# end
#end
end