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
This commit is contained in:
Eric Davis
2009-10-21 22:34:28 +00:00
parent ac4937a767
commit e76d4c5c4c
9 changed files with 85 additions and 6 deletions
@@ -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