annotate test/unit/helpers/timelog_helper_test.rb @ 1628:9c5f8e24dadc live tip

Quieten this cron script
author Chris Cannam
date Tue, 25 Aug 2020 11:38:49 +0100
parents e248c7af89ec
children
rev   line source
Chris@0 1 # Redmine - project management software
Chris@1494 2 # Copyright (C) 2006-2014 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@1464 22 include Redmine::I18n
Chris@0 23 include ActionView::Helpers::TextHelper
Chris@0 24 include ActionView::Helpers::DateHelper
Chris@1115 25 include ERB::Util
Chris@909 26
Chris@0 27 fixtures :projects, :roles, :enabled_modules, :users,
Chris@909 28 :repositories, :changesets,
Chris@0 29 :trackers, :issue_statuses, :issues, :versions, :documents,
Chris@0 30 :wikis, :wiki_pages, :wiki_contents,
Chris@0 31 :boards, :messages,
Chris@0 32 :attachments,
Chris@0 33 :enumerations
Chris@909 34
Chris@0 35 def setup
Chris@0 36 super
Chris@0 37 end
Chris@0 38
Chris@0 39 def test_activities_collection_for_select_options_should_return_array_of_activity_names_and_ids
Chris@0 40 activities = activity_collection_for_select_options
Chris@0 41 assert activities.include?(["Design", 9])
Chris@0 42 assert activities.include?(["Development", 10])
Chris@0 43 end
Chris@909 44
Chris@0 45 def test_activities_collection_for_select_options_should_not_include_inactive_activities
Chris@0 46 activities = activity_collection_for_select_options
Chris@0 47 assert !activities.include?(["Inactive Activity", 14])
Chris@0 48 end
Chris@0 49
Chris@0 50 def test_activities_collection_for_select_options_should_use_the_projects_override
Chris@0 51 project = Project.find(1)
Chris@0 52 override_activity = TimeEntryActivity.create!({:name => "Design override", :parent => TimeEntryActivity.find_by_name("Design"), :project => project})
Chris@0 53
Chris@0 54 activities = activity_collection_for_select_options(nil, project)
Chris@0 55 assert !activities.include?(["Design", 9]), "System activity found in: " + activities.inspect
Chris@0 56 assert activities.include?(["Design override", override_activity.id]), "Override activity not found in: " + activities.inspect
Chris@0 57 end
Chris@0 58 end