[#5421] Add Assign Deliverable to Issue permission for the issue bulk edit form
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<% if project.module_enabled?(:contracts) %>
|
<% if project.module_enabled?(:contracts) && User.current.allowed_to?(:assign_deliverable_to_issue, project) %>
|
||||||
<p>
|
<p>
|
||||||
<%= label_tag(:deliverable_id, l(:field_deliverable)) %>
|
<%= label_tag(:deliverable_id, l(:field_deliverable)) %>
|
||||||
<% options = project.contracts.inject([]) {|data, contract|
|
<% options = project.contracts.inject([]) {|data, contract|
|
||||||
|
|||||||
+28
-11
@@ -23,22 +23,39 @@ class RedmineContracts::Hooks::ViewIssuesBulkEditDetailsBottomHookTest < ActionC
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "with Contracts Enabled" do
|
context "with Contracts Enabled" do
|
||||||
setup do
|
context "with permission to Assign Deliverable" do
|
||||||
visit_issue_bulk_edit_page([@issue, @issue2, @issue3])
|
setup do
|
||||||
end
|
@role.permissions << :assign_deliverable_to_issue
|
||||||
|
@role.save!
|
||||||
should "render the a select field for the deliverables with all of the deliverables grouped by contract" do
|
visit_issue_bulk_edit_page([@issue, @issue2, @issue3])
|
||||||
|
end
|
||||||
|
|
||||||
assert_select "select#deliverable_id" do
|
should "render the a select field for the deliverables with all of the deliverables grouped by contract" do
|
||||||
assert_select "optgroup[label=?]", @contract1.name do
|
|
||||||
assert_select "option", :text => /#{@deliverable1.title}/
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_select "optgroup[label=?]", @contract2.name do
|
assert_select "select#deliverable_id" do
|
||||||
assert_select "option", :text => /#{@deliverable2.title}/
|
assert_select "optgroup[label=?]", @contract1.name do
|
||||||
|
assert_select "option", :text => /#{@deliverable1.title}/
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_select "optgroup[label=?]", @contract2.name do
|
||||||
|
assert_select "option", :text => /#{@deliverable2.title}/
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with no permission to Assign Deliverable" do
|
||||||
|
setup do
|
||||||
|
@role.permissions.delete(:assign_deliverable_to_issue)
|
||||||
|
@role.save!
|
||||||
|
visit_issue_bulk_edit_page([@issue, @issue2, @issue3])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "not render the deliverable select field" do
|
||||||
|
assert_select 'select#deliverable_id', :count => 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with Contracts Disabled" do
|
context "with Contracts Disabled" do
|
||||||
|
|||||||
Reference in New Issue
Block a user