annotate test/unit/helpers/.svn/text-base/timelog_helper_test.rb.svn-base @ 882:9e27d0747c77 bug_97

Close obsolete branch bug_97
author Chris Cannam
date Fri, 25 Mar 2011 13:58:03 +0000
parents 513646585e45
children af80e5618e9b
rev   line source
Chris@0 1 # Redmine - project management software
Chris@0 2 # Copyright (C) 2006-2009 Jean-Philippe Lang
Chris@0 3 #
Chris@0 4 # This program is free software; you can redistribute it and/or
Chris@0 5 # modify it under the terms of the GNU General Public License
Chris@0 6 # as published by the Free Software Foundation; either version 2
Chris@0 7 # of the License, or (at your option) any later version.
Chris@0 8 #
Chris@0 9 # This program is distributed in the hope that it will be useful,
Chris@0 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 12 # GNU General Public License for more details.
Chris@0 13 #
Chris@0 14 # You should have received a copy of the GNU General Public License
Chris@0 15 # along with this program; if not, write to the Free Software
Chris@0 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@0 17
Chris@0 18 require File.dirname(__FILE__) + '/../../test_helper'
Chris@0 19
Chris@0 20 class TimelogHelperTest < HelperTestCase
Chris@0 21 include TimelogHelper
Chris@0 22 include ActionView::Helpers::TextHelper
Chris@0 23 include ActionView::Helpers::DateHelper
Chris@0 24
Chris@0 25 fixtures :projects, :roles, :enabled_modules, :users,
Chris@0 26 :repositories, :changesets,
Chris@0 27 :trackers, :issue_statuses, :issues, :versions, :documents,
Chris@0 28 :wikis, :wiki_pages, :wiki_contents,
Chris@0 29 :boards, :messages,
Chris@0 30 :attachments,
Chris@0 31 :enumerations
Chris@0 32
Chris@0 33 def setup
Chris@0 34 super
Chris@0 35 end
Chris@0 36
Chris@0 37 def test_activities_collection_for_select_options_should_return_array_of_activity_names_and_ids
Chris@0 38 activities = activity_collection_for_select_options
Chris@0 39 assert activities.include?(["Design", 9])
Chris@0 40 assert activities.include?(["Development", 10])
Chris@0 41 end
Chris@0 42
Chris@0 43 def test_activities_collection_for_select_options_should_not_include_inactive_activities
Chris@0 44 activities = activity_collection_for_select_options
Chris@0 45 assert !activities.include?(["Inactive Activity", 14])
Chris@0 46 end
Chris@0 47
Chris@0 48 def test_activities_collection_for_select_options_should_use_the_projects_override
Chris@0 49 project = Project.find(1)
Chris@0 50 override_activity = TimeEntryActivity.create!({:name => "Design override", :parent => TimeEntryActivity.find_by_name("Design"), :project => project})
Chris@0 51
Chris@0 52 activities = activity_collection_for_select_options(nil, project)
Chris@0 53 assert !activities.include?(["Design", 9]), "System activity found in: " + activities.inspect
Chris@0 54 assert activities.include?(["Design override", override_activity.id]), "Override activity not found in: " + activities.inspect
Chris@0 55 end
Chris@0 56 end