[#4327] Added the Deliverable field to the bulk edit.

This commit is contained in:
Eric Davis
2010-08-03 11:24:23 -07:00
parent 6ad50c57b2
commit 72aeaac59a
5 changed files with 83 additions and 0 deletions
@@ -0,0 +1,55 @@
require File.dirname(__FILE__) + '/../../../test_helper'
class RedmineContracts::Hooks::ViewIssuesBulkEditDetailsBottomHookTest < ActionController::IntegrationTest
include Redmine::Hook::Helper
context "#view_issues_bulk_edit_details_bottom" do
setup do
@project = Project.generate!
@issue = Issue.generate_for_project!(@project)
@issue2 = Issue.generate_for_project!(@project)
@issue3 = Issue.generate_for_project!(@project)
@contract1 = Contract.generate!(:project => @project)
@contract2 = Contract.generate!(:project => @project)
@manager = User.generate!(:login => 'manager', :password => 'existing', :password_confirmation => 'existing')
@role = Role.generate!(:permissions => [:view_issues, :edit_issues])
User.add_to_project(@manager, @project, @role)
@deliverable1 = FixedDeliverable.generate!(:contract => @contract1, :manager => @manager, :title => 'The Title')
@deliverable2 = FixedDeliverable.generate!(:contract => @contract2, :manager => @manager, :title => 'The Title')
@issue.deliverable = @deliverable1
login_as('manager', 'existing')
end
context "with Contracts Enabled" do
setup do
visit_issue_bulk_edit_page([@issue, @issue2, @issue3])
end
should "render the a select field for the deliverables with all of the deliverables grouped by contract" do
assert_select "select#deliverable_id" do
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
context "with Contracts Disabled" do
setup do
@project.enabled_modules.collect {|m| m.destroy if m.name == 'contracts' }
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
+4
View File
@@ -75,6 +75,10 @@ module IntegrationTestHelper
visit '/issues/' + issue.id.to_s
end
def visit_issue_bulk_edit_page(issues)
visit url_for(:controller => 'issues', :action => 'bulk_edit', :ids => issues.collect(&:id))
end
def assert_forbidden
assert_response :forbidden
assert_template 'common/403'