You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

timelog_helper_test.rb 2.4KB

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