specfix: checks on validity for cross project hierarchies between issues is only possible if such a hierarchy is allowed generally

pull/6827/head
Jens Ulferts 13 years ago
parent 73def6e877
commit ad8fc06607
  1. 19
      spec/models/issue_hierarchy_restriction_project_boundaries_spec.rb

@ -1,5 +1,19 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
def project_boundaries_spanning_issue_hierarchy_allowed?
issue = Issue.new
issue.project_id = 1
issue.build_project
parent_issue = Issue.new
parent_issue.project_id = 2
issue.instance_eval do
@parent_issue = parent_issue
end
issue.valid?
#using not so good check on validity
issue.errors[:parent_issue_id] != "doesn't belong to the same project"
end
describe Issue, 'parent-child relationships between backlogs stories and backlogs tasks are prohibited if they span project boundaries' do
let(:tracker_feature) { Factory.build(:tracker_feature) }
let(:tracker_task) { Factory.build(:tracker_task) }
@ -94,7 +108,10 @@ describe Issue, 'parent-child relationships between backlogs stories and backlog
end
end
if project_boundaries_spanning_issue_hierarchy_allowed?
describe "WHEN creating the child" do
shared_examples_for "restricted hierarchy on creation" do
before(:each) do
parent.project = parent_project
@ -356,6 +373,6 @@ describe Issue, 'parent-child relationships between backlogs stories and backlog
it_should_behave_like "unrestricted hierarchy even when enabling backlogs"
end
end
end
end
end
Loading…
Cancel
Save