Allows inter-project work package hierarchies

[skip ci]
pull/394/head
Hagen Schink 11 years ago
parent b72129b210
commit 4d5f395fdf
  1. 1
      app/models/work_package/validations.rb
  2. 14
      spec/models/planning_element_spec.rb

@ -65,7 +65,6 @@ module WorkPackage::Validations
def validate_parent_constraint
if self.parent
errors.add :parent, :cannot_be_milestone if parent.is_milestone?
errors.add :parent, :cannot_be_in_another_project if parent.project != project
errors.add :parent, :cannot_be_in_recycle_bin if parent.deleted?
end
end

@ -171,20 +171,6 @@ describe PlanningElement do
planning_element.errors[:parent].should be_present
planning_element.errors[:parent].should == ["cannot be a milestone"]
end
it 'is invalid if parent is in another project' do
parent = PlanningElement.new.tap do |pe|
pe.send(:assign_attributes, attributes.merge(:project_id => FactoryGirl.build(:project)), :without_protection => true)
end
attributes[:parent] = parent
planning_element = PlanningElement.new.tap { |pe| pe.send(:assign_attributes, attributes, :without_protection => true) }
planning_element.should_not be_valid
planning_element.errors[:parent].should be_present
planning_element.errors[:parent].should == ["cannot be in another project"]
end
end
end

Loading…
Cancel
Save