summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-03-15 10:38:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-03-15 10:38:56 +0000
commit84f322b2af0e2a781a1fcc3ae4dd1e6845b22b66 (patch)
tree87a00a7afb6748ecc62d02e61b5b9bdba73269a3 /test
parent3b59c6dfb200bc5d5434cdc1f5a71478747297d9 (diff)
downloadredmine-84f322b2af0e2a781a1fcc3ae4dd1e6845b22b66.tar.gz
redmine-84f322b2af0e2a781a1fcc3ae4dd1e6845b22b66.zip
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
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/trackers.yml2
-rw-r--r--test/functional/issues_controller_test.rb43
-rw-r--r--test/integration/api_test/trackers_test.rb1
-rw-r--r--test/unit/tracker_test.rb6
4 files changed, 52 insertions, 0 deletions
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