summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-10-21 22:34:28 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-10-21 22:34:28 +0000
commite76d4c5c4c3f2beb8be1f441148e4627a14d37d1 (patch)
tree8f1ea0620882ad97d3804018d109f8a35f1ed4a0 /test
parentac4937a76755de2f9b6a83f6160efa0fde2d03aa (diff)
downloadredmine-e76d4c5c4c3f2beb8be1f441148e4627a14d37d1.tar.gz
redmine-e76d4c5c4c3f2beb8be1f441148e4627a14d37d1.zip
Added an active field track if an Enumeration is active on the frontend view.
* Changed TimelogHelper#activity_collection_for_select_options to only use active TimeEntryActivities. * Changed TimelogHelper#activity_collection_for_select_options to return a blank option if the time_entry's current activity is inactive. #4077 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2946 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/enumerations.yml19
-rw-r--r--test/functional/timelog_controller_test.rb23
2 files changed, 42 insertions, 0 deletions
diff --git a/test/fixtures/enumerations.yml b/test/fixtures/enumerations.yml
index c9d619e64..7deacd731 100644
--- a/test/fixtures/enumerations.yml
+++ b/test/fixtures/enumerations.yml
@@ -4,66 +4,85 @@ enumerations_001:
id: 1
opt: DCAT
type: DocumentCategory
+ active: true
enumerations_002:
name: User documentation
id: 2
opt: DCAT
type: DocumentCategory
+ active: true
enumerations_003:
name: Technical documentation
id: 3
opt: DCAT
type: DocumentCategory
+ active: true
enumerations_004:
name: Low
id: 4
opt: IPRI
type: IssuePriority
+ active: true
enumerations_005:
name: Normal
id: 5
opt: IPRI
type: IssuePriority
is_default: true
+ active: true
enumerations_006:
name: High
id: 6
opt: IPRI
type: IssuePriority
+ active: true
enumerations_007:
name: Urgent
id: 7
opt: IPRI
type: IssuePriority
+ active: true
enumerations_008:
name: Immediate
id: 8
opt: IPRI
type: IssuePriority
+ active: true
enumerations_009:
name: Design
id: 9
opt: ACTI
type: TimeEntryActivity
+ active: true
enumerations_010:
name: Development
id: 10
opt: ACTI
type: TimeEntryActivity
is_default: true
+ active: true
enumerations_011:
name: QA
id: 11
opt: ACTI
type: TimeEntryActivity
+ active: true
enumerations_012:
name: Default Enumeration
id: 12
opt: ''
type: Enumeration
is_default: true
+ active: true
enumerations_013:
name: Another Enumeration
id: 13
opt: ''
type: Enumeration
+ active: true
+enumerations_014:
+ name: Inactive Activity
+ id: 14
+ opt: ACTI
+ type: TimeEntryActivity
+ active: false
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index e9ca2d2bb..01ca505a0 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
#
@@ -71,6 +72,28 @@ class TimelogControllerTest < ActionController::TestCase
assert_tag :tag => 'form', :attributes => { :action => '/projects/ecookbook/timelog/edit/2' }
end
+ def test_get_edit_should_only_show_active_time_entry_activities
+ @request.session[:user_id] = 3
+ get :edit, :project_id => 1
+ assert_response :success
+ assert_template 'edit'
+ assert_no_tag :tag => 'option', :content => 'Inactive Activity'
+
+ end
+
+ def test_get_edit_with_an_existing_time_entry_with_inactive_activity
+ te = TimeEntry.find(1)
+ te.activity = TimeEntryActivity.find_by_name("Inactive Activity")
+ te.save!
+
+ @request.session[:user_id] = 1
+ get :edit, :project_id => 1, :id => 1
+ assert_response :success
+ assert_template 'edit'
+ # Blank option since nothing is pre-selected
+ assert_tag :tag => 'option', :content => '--- Please select ---'
+ end
+
def test_post_edit
# TODO: should POST to issues’ time log instead of project. change form
# and routing