summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-09 17:16:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-09 17:16:55 +0000
commit4019ba76ab3005ccc1f0495069861e4a8814be55 (patch)
treee915b28bd60fc61d1cf1ee149553cfe4de71b35c /test
parent979b5f15db88f1e7a04f1c4d0dba7e9f2379ddb0 (diff)
downloadredmine-4019ba76ab3005ccc1f0495069861e4a8814be55.tar.gz
redmine-4019ba76ab3005ccc1f0495069861e4a8814be55.zip
Restores the "New issue" tab in the project menu and makes it optional (#6204).
git-svn-id: http://svn.redmine.org/redmine/trunk@15407 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb54
1 files changed, 50 insertions, 4 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 0a021289a..8e04d7cf5 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -1060,7 +1060,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_index_should_include_new_issue_link
@request.session[:user_id] = 2
get :index, :project_id => 1
- assert_select 'a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue'
+ assert_select '#content a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue'
end
def test_index_should_not_include_new_issue_link_for_project_without_trackers
@@ -1068,7 +1068,7 @@ class IssuesControllerTest < ActionController::TestCase
@request.session[:user_id] = 2
get :index, :project_id => 1
- assert_select 'a.new-issue', 0
+ assert_select '#content a.new-issue', 0
end
def test_index_should_not_include_new_issue_link_for_users_with_copy_issues_permission_only
@@ -1078,13 +1078,59 @@ class IssuesControllerTest < ActionController::TestCase
@request.session[:user_id] = 2
get :index, :project_id => 1
- assert_select 'a.new-issue', 0
+ assert_select '#content a.new-issue', 0
end
def test_index_without_project_should_include_new_issue_link
@request.session[:user_id] = 2
get :index
- assert_select 'a.new-issue[href="/issues/new"]', :text => 'New issue'
+ assert_select '#content a.new-issue[href="/issues/new"]', :text => 'New issue'
+ end
+
+ def test_index_should_not_include_new_issue_tab_when_disabled
+ with_settings :new_project_issue_tab_enabled => '0' do
+ @request.session[:user_id] = 2
+ get :index, :project_id => 1
+ assert_select '#main-menu a.new-issue', 0
+ end
+ end
+
+ def test_index_should_include_new_issue_tab_when_enabled
+ with_settings :new_project_issue_tab_enabled => '1' do
+ @request.session[:user_id] = 2
+ get :index, :project_id => 1
+ assert_select '#main-menu a.new-issue[href="/projects/ecookbook/issues/new"]', :text => 'New issue'
+ end
+ end
+
+ def test_new_should_have_new_issue_tab_as_current_menu_item
+ with_settings :new_project_issue_tab_enabled => '1' do
+ @request.session[:user_id] = 2
+ get :new, :project_id => 1
+ assert_select '#main-menu a.new-issue.selected'
+ end
+ end
+
+ def test_index_should_not_include_new_issue_tab_for_project_without_trackers
+ with_settings :new_project_issue_tab_enabled => '1' do
+ Project.find(1).trackers.clear
+
+ @request.session[:user_id] = 2
+ get :index, :project_id => 1
+ assert_select '#main-menu a.new-issue', 0
+ end
+ end
+
+ def test_index_should_not_include_new_issue_tab_for_users_with_copy_issues_permission_only
+ with_settings :new_project_issue_tab_enabled => '1' do
+ role = Role.find(1)
+ role.remove_permission! :add_issues
+ role.add_permission! :copy_issues
+
+ @request.session[:user_id] = 2
+ get :index, :project_id => 1
+ assert_select '#main-menu a.new-issue', 0
+ end
end
def test_show_by_anonymous