From d5cc7424a815a68a21ea080827f737d00b18e88e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Barth Date: Mon, 13 Jun 2011 19:43:40 +0000 Subject: Do not show inactive issue priorities where not necessary (#8573). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6070 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/fixtures/enumerations.yml | 6 ++++++ test/functional/context_menus_controller_test.rb | 1 + test/functional/issue_moves_controller_test.rb | 19 ++++++++++++++++++ test/functional/issues_controller_test.rb | 25 ++++++++++++++++++++++++ 4 files changed, 51 insertions(+) (limited to 'test') diff --git a/test/fixtures/enumerations.yml b/test/fixtures/enumerations.yml index c4a25d954..9d9556607 100644 --- a/test/fixtures/enumerations.yml +++ b/test/fixtures/enumerations.yml @@ -81,3 +81,9 @@ enumerations_014: type: TimeEntryActivity position: 4 active: false +enumerations_015: + name: Inactive Priority + id: 15 + type: IssuePriority + position: 6 + active: false diff --git a/test/functional/context_menus_controller_test.rb b/test/functional/context_menus_controller_test.rb index 67e919a9c..23b1ca514 100644 --- a/test/functional/context_menus_controller_test.rb +++ b/test/functional/context_menus_controller_test.rb @@ -17,6 +17,7 @@ class ContextMenusControllerTest < ActionController::TestCase assert_tag :tag => 'a', :content => 'Immediate', :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bpriority_id%5D=8', :class => '' } + assert_no_tag :tag => 'a', :content => 'Inactive Priority' # Versions assert_tag :tag => 'a', :content => '2.0', :attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&issue%5Bfixed_version_id%5D=3', diff --git a/test/functional/issue_moves_controller_test.rb b/test/functional/issue_moves_controller_test.rb index 6c2cdb7cc..2a9caca0f 100644 --- a/test/functional/issue_moves_controller_test.rb +++ b/test/functional/issue_moves_controller_test.rb @@ -7,6 +7,25 @@ class IssueMovesControllerTest < ActionController::TestCase User.current = nil end + def test_get_issue_moves_new + @request.session[:user_id] = 2 + get :new, :id => 1 + + assert_tag :tag => 'option', :content => 'eCookbook', + :attributes => { :value => '1', :selected => 'selected' } + %w(new_tracker_id status_id priority_id assigned_to_id).each do |field| + assert_tag :tag => 'option', :content => '(No change)', :attributes => { :value => '' }, + :parent => {:tag => 'select', :attributes => {:id => field}} + assert_no_tag :tag => 'option', :attributes => {:selected => 'selected'}, + :parent => {:tag => 'select', :attributes => {:id => field}} + end + + # Be sure we don't include inactive enumerations + assert ! IssuePriority.find(15).active? + assert_no_tag :option, :attributes => {:value => '15'}, + :parent => {:tag => 'select', :attributes => {:id => 'priority_id'} } + end + def test_create_one_issue_to_another_project @request.session[:user_id] = 2 post :create, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => '' diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index d97043014..be9ca2f04 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -318,6 +318,16 @@ class IssuesControllerTest < ActionController::TestCase :content => /Notes/ } } end + def test_update_form_should_not_display_inactive_enumerations + @request.session[:user_id] = 2 + get :show, :id => 1 + assert_response :success + + assert ! IssuePriority.find(15).active? + assert_no_tag :option, :attributes => {:value => '15'}, + :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} } + end + def test_show_should_deny_anonymous_access_without_permission Role.anonymous.remove_permission!(:view_issues) get :show, :id => 1 @@ -419,6 +429,11 @@ class IssuesControllerTest < ActionController::TestCase assert_tag :tag => 'input', :attributes => { :name => 'issue[custom_field_values][2]', :value => 'Default string' } + + # Be sure we don't display inactive IssuePriorities + assert ! IssuePriority.find(15).active? + assert_no_tag :option, :attributes => {:value => '15'}, + :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} } end def test_get_new_without_tracker_id @@ -833,6 +848,11 @@ class IssuesControllerTest < ActionController::TestCase assert_template 'edit' assert_not_nil assigns(:issue) assert_equal Issue.find(1), assigns(:issue) + + # Be sure we don't display inactive IssuePriorities + assert ! IssuePriority.find(15).active? + assert_no_tag :option, :attributes => {:value => '15'}, + :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} } end def test_get_edit_with_params @@ -1185,6 +1205,11 @@ class IssuesControllerTest < ActionController::TestCase # System wide custom field assert CustomField.find(1).is_for_all? assert_tag :select, :attributes => {:name => 'issue[custom_field_values][1]'} + + # Be sure we don't display inactive IssuePriorities + assert ! IssuePriority.find(15).active? + assert_no_tag :option, :attributes => {:value => '15'}, + :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} } end def test_get_bulk_edit_on_different_projects -- cgit v1.2.3