#3178: blocks_ids will be ids of issues with which a blocking relation is defined until new ids are provided

pull/6827/head
Jens Ulferts 14 years ago
parent cb8f343439
commit bf3430004d
  1. 6
      app/models/impediment.rb
  2. 15
      spec/models/impediment_spec.rb

@ -49,16 +49,14 @@ class Impediment < Task
end
def blocks_ids
@blocks_ids_list ||= relations_from.select{ |rel| rel.relation_type == IssueRelation::TYPE_BLOCKS }
@blocks_ids_list ||= relations_from.select{ |rel| rel.relation_type == IssueRelation::TYPE_BLOCKS }.collect(&:issue_to_id)
end
def update_with_relationships(params)
attribs = params.clone.delete_if { |k, v| !safe_attribute_names.include?(k) }
attribs = params.reject { |k, v| !safe_attribute_names.include?(k.to_s) }
attribs[:remaining_hours] = 0 if IssueStatus.find(params[:status_id]).is_closed?
attribs[:blocks_ids] = params[:blocks] if params[:blocks] #if blocks param was not sent, that means the impediment was just dragged
result = journalized_update_attributes(attribs)
move_after params[:prev] if result

@ -250,6 +250,21 @@ describe Impediment do
impediment.blocks_ids.should eql [1,2,3]
end
end
describe "WITH only prior blockers defined" do
before(:each) do
feature.fixed_version = version
feature.save
task.fixed_version = version
task.save
impediment.relations_from = [IssueRelation.new(:issue_from => impediment, :issue_to => feature, :relation_type => IssueRelation::TYPE_BLOCKS),
IssueRelation.new(:issue_from => impediment, :issue_to => task, :relation_type => IssueRelation::TYPE_BLOCKS)]
true
end
it { impediment.blocks_ids.should eql [feature.id, task.id] }
end
end
end
end
Loading…
Cancel
Save