annotate test/unit/helpers/timelog_helper_test.rb @ 1465:ab8bd24eeb65 bug_635

Close obsolete branch bug_635
author Chris Cannam
date Fri, 19 Jul 2013 12:13:20 +0100
parents 433d4f72a19b
children 622f24f53b42 261b3d9a4903
rev   line source
Chris@0 1 # Redmine - project management software
Chris@1115 2 # Copyright (C) 2006-2012 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@909 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@909 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@119 18 require File.expand_path('../../../test_helper', __FILE__)
Chris@0 19
Chris@909 20 class TimelogHelperTest < ActionView::TestCase
Chris@0 21 include TimelogHelper
Chris@0 22 include ActionView::Helpers::TextHelper
Chris@0 23 include ActionView::Helpers::DateHelper
Chris@1115 24 include ERB::Util
Chris@909 25
Chris@0 26 fixtures :projects, :roles, :enabled_modules, :users,
Chris@909 27 :repositories, :changesets,
Chris@0 28 :trackers, :issue_statuses, :issues, :versions, :documents,
Chris@0 29 :wikis, :wiki_pages, :wiki_contents,
Chris@0 30 :boards, :messages,
Chris@0 31 :attachments,
Chris@0 32 :enumerations
Chris@909 33
Chris@0 34 def setup
Chris@0 35 super
Chris@0 36 end
Chris@0 37
Chris@0 38 def test_activities_collection_for_select_options_should_return_array_of_activity_names_and_ids
Chris@0 39 activities = activity_collection_for_select_options
Chris@0 40 assert activities.include?(["Design", 9])
Chris@0 41 assert activities.include?(["Development", 10])
Chris@0 42 end
Chris@909 43
Chris@0 44 def test_activities_collection_for_select_options_should_not_include_inactive_activities
Chris@0 45 activities = activity_collection_for_select_options
Chris@0 46 assert !activities.include?(["Inactive Activity", 14])
Chris@0 47 end
Chris@0 48
Chris@0 49 def test_activities_collection_for_select_options_should_use_the_projects_override
Chris@0 50 project = Project.find(1)
Chris@0 51 override_activity = TimeEntryActivity.create!({:name => "Design override", :parent => TimeEntryActivity.find_by_name("Design"), :project => project})
Chris@0 52
Chris@0 53 activities = activity_collection_for_select_options(nil, project)
Chris@0 54 assert !activities.include?(["Design", 9]), "System activity found in: " + activities.inspect
Chris@0 55 assert activities.include?(["Design override", override_activity.id]), "Override activity not found in: " + activities.inspect
Chris@0 56 end
Chris@0 57 end