default_data_test.rb
49 lines
| 1.7 KiB
| text/x-ruby
|
RubyLexer
|
r5725 | # Redmine - project management software | ||
# Copyright (C) 2006-2011 Jean-Philippe Lang | ||||
|
r1658 | # | ||
# This program is free software; you can redistribute it and/or | ||||
# modify it under the terms of the GNU General Public License | ||||
# as published by the Free Software Foundation; either version 2 | ||||
# of the License, or (at your option) any later version. | ||||
|
r5725 | # | ||
|
r1658 | # This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
# GNU General Public License for more details. | ||||
|
r5725 | # | ||
|
r1658 | # You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
|
r4395 | require File.expand_path('../../test_helper', __FILE__) | ||
|
r1658 | |||
|
r2773 | class DefaultDataTest < ActiveSupport::TestCase | ||
|
r2430 | include Redmine::I18n | ||
|
r1658 | fixtures :roles | ||
|
r5725 | |||
|
r1658 | def test_no_data | ||
assert !Redmine::DefaultData::Loader::no_data? | ||||
Role.delete_all("builtin = 0") | ||||
Tracker.delete_all | ||||
IssueStatus.delete_all | ||||
Enumeration.delete_all | ||||
assert Redmine::DefaultData::Loader::no_data? | ||||
end | ||||
|
r5725 | |||
|
r1658 | def test_load | ||
|
r2430 | valid_languages.each do |lang| | ||
|
r1658 | begin | ||
Role.delete_all("builtin = 0") | ||||
Tracker.delete_all | ||||
IssueStatus.delete_all | ||||
Enumeration.delete_all | ||||
assert Redmine::DefaultData::Loader::load(lang) | ||||
|
r2692 | assert_not_nil DocumentCategory.first | ||
assert_not_nil IssuePriority.first | ||||
assert_not_nil TimeEntryActivity.first | ||||
|
r1658 | rescue ActiveRecord::RecordInvalid => e | ||
assert false, ":#{lang} default data is invalid (#{e.message})." | ||||
end | ||||
end | ||||
end | ||||
end | ||||