From 84f322b2af0e2a781a1fcc3ae4dd1e6845b22b66 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 15 Mar 2019 10:38:56 +0000 Subject: Add a description for trackers (#442). Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17970 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/fixtures/trackers.yml | 2 ++ test/functional/issues_controller_test.rb | 43 ++++++++++++++++++++++++++++++ test/integration/api_test/trackers_test.rb | 1 + test/unit/tracker_test.rb | 6 +++++ 4 files changed, 52 insertions(+) (limited to 'test') diff --git a/test/fixtures/trackers.yml b/test/fixtures/trackers.yml index c969549f6..41602a78f 100644 --- a/test/fixtures/trackers.yml +++ b/test/fixtures/trackers.yml @@ -5,12 +5,14 @@ trackers_001: is_in_chlog: true default_status_id: 1 position: 1 + description: Description for Bug tracker trackers_002: name: Feature request id: 2 is_in_chlog: true default_status_id: 1 position: 2 + description: Description for Feature request tracker trackers_003: name: Support request id: 3 diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 30ecd3073..e1637d83d 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2969,6 +2969,49 @@ class IssuesControllerTest < Redmine::ControllerTest assert_select 'option', text: /#{t.name}/, count: 0 end + def test_get_new_should_show_trackers_description + @request.session[:user_id] = 2 + get :new, :params => { + :project_id => 1, + :issue => { + :tracker_id => 1 + } + } + assert_response :success + + assert_select 'form#issue-form' do + assert_select 'a[title=?]', 'View all trackers description', :text => 'View all trackers description' + assert_select 'select[name=?][title=?]', 'issue[tracker_id]', 'Description for Bug tracker' + end + + assert_select 'div#trackers_description' do + assert_select 'h3', 1, :text => 'Trackers description' + # only Bug and Feature have descriptions + assert_select 'dt', 2, :text => 'Bug' + assert_select 'dd', 2, :text => 'Description for Bug tracker' + end + end + + def test_get_new_should_not_show_trackers_description_for_trackers_without_description + Tracker.update_all(:description => '') + + @request.session[:user_id] = 2 + get :new, :params => { + :project_id => 1, + :issue => { + :tracker_id => 1 + } + } + assert_response :success + + assert_select 'form#issue-form' do + assert_select 'a[title=?]', 'View all trackers description', 0 + assert_select 'select[name=?][title=?]', 'issue[tracker_id]', '' + end + + assert_select 'div#trackers_description', 0 + end + def test_update_form_for_new_issue @request.session[:user_id] = 2 post :new, :params => { diff --git a/test/integration/api_test/trackers_test.rb b/test/integration/api_test/trackers_test.rb index d29f288c4..3e89aeec3 100644 --- a/test/integration/api_test/trackers_test.rb +++ b/test/integration/api_test/trackers_test.rb @@ -30,6 +30,7 @@ class Redmine::ApiTest::TrackersTest < Redmine::ApiTest::Base assert_select 'trackers[type=array] tracker id', :text => '2' do assert_select '~ name', :text => 'Feature request' + assert_select '~ description', :text => 'Description for Feature request tracker' end end end diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb index f5cacd986..9f471ee87 100644 --- a/test/unit/tracker_test.rb +++ b/test/unit/tracker_test.rb @@ -134,4 +134,10 @@ class TrackerTest < ActiveSupport::TestCase end end end + + def test_tracker_should_have_description + tracker = Tracker.find(1) + assert tracker.respond_to?(:description) + assert_equal tracker.description, "Description for Bug tracker" + end end -- cgit v1.2.3