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.

default_data_test.rb 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2013 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 DefaultDataTest < ActiveSupport::TestCase
  19. include Redmine::I18n
  20. fixtures :roles
  21. def test_no_data
  22. assert !Redmine::DefaultData::Loader::no_data?
  23. Role.delete_all("builtin = 0")
  24. Tracker.delete_all
  25. IssueStatus.delete_all
  26. Enumeration.delete_all
  27. assert Redmine::DefaultData::Loader::no_data?
  28. end
  29. def test_load
  30. valid_languages.each do |lang|
  31. begin
  32. Role.delete_all("builtin = 0")
  33. Tracker.delete_all
  34. IssueStatus.delete_all
  35. Enumeration.delete_all
  36. assert Redmine::DefaultData::Loader::load(lang)
  37. assert_not_nil DocumentCategory.first
  38. assert_not_nil IssuePriority.first
  39. assert_not_nil TimeEntryActivity.first
  40. rescue ActiveRecord::RecordInvalid => e
  41. assert false, ":#{lang} default data is invalid (#{e.message})."
  42. end
  43. end
  44. end
  45. end