[#6441] Block assigning issues to deliverable on a locked or closed contract
This commit is contained in:
@@ -70,6 +70,38 @@ class RedmineContracts::Hooks::ControllerIssuesEditBeforeSaveTest < ActionContro
|
||||
|
||||
end
|
||||
|
||||
should "not allow setting a Deliverable on a locked Contract" do
|
||||
assert @contract2.lock!
|
||||
click_link "New issue"
|
||||
|
||||
fill_in "Subject", :with => 'Hook test'
|
||||
select @deliverable2.title, :from => "Deliverable"
|
||||
assert_no_difference("Issue.count") do
|
||||
click_button "Create"
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
assert_equal nil, Issue.last.deliverable
|
||||
|
||||
end
|
||||
|
||||
should "not allow setting a Deliverable on a closed Contract" do
|
||||
assert @contract2.close!
|
||||
click_link "New issue"
|
||||
|
||||
fill_in "Subject", :with => 'Hook test'
|
||||
select @deliverable2.title, :from => "Deliverable"
|
||||
assert_no_difference("Issue.count") do
|
||||
click_button "Create"
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
assert_equal nil, Issue.last.deliverable
|
||||
|
||||
end
|
||||
|
||||
context "with no permission to Assign Deliverable" do
|
||||
should "not allow setting the Deliverable (force HTTP request)" do
|
||||
@role.permissions.delete(:assign_deliverable_to_issue)
|
||||
@@ -125,6 +157,30 @@ class RedmineContracts::Hooks::ControllerIssuesEditBeforeSaveTest < ActionContro
|
||||
|
||||
end
|
||||
|
||||
should "not allow updating to a deliverable on a locked contract" do
|
||||
assert @contract2.lock!
|
||||
select @deliverable2.title, :from => "Deliverable"
|
||||
click_button "Submit"
|
||||
|
||||
assert_response :success
|
||||
|
||||
@issue.reload
|
||||
assert_equal nil, @issue.deliverable
|
||||
|
||||
end
|
||||
|
||||
should "not allow updating to a deliverable on a closed contract" do
|
||||
assert @contract2.close!
|
||||
select @deliverable2.title, :from => "Deliverable"
|
||||
click_button "Submit"
|
||||
|
||||
assert_response :success
|
||||
|
||||
@issue.reload
|
||||
assert_equal nil, @issue.deliverable
|
||||
|
||||
end
|
||||
|
||||
should "allow updating an issue, even if the deliverable is locked as long as the deliverable isn't changed" do
|
||||
select @deliverable2.title, :from => "Deliverable"
|
||||
click_button "Submit"
|
||||
|
||||
Reference in New Issue
Block a user