mirror of
https://github.com/redmine/redmine.git
synced 2025-11-09 06:46:01 +01:00
Skip workflow creation in tests for each locale.
git-svn-id: http://svn.redmine.org/redmine/trunk@16115 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -34,9 +34,10 @@ module Redmine
|
||||
|
||||
# Loads the default data
|
||||
# Raises a RecordNotSaved exception if something goes wrong
|
||||
def load(lang=nil)
|
||||
def load(lang=nil, options={})
|
||||
raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data?
|
||||
set_language_if_valid(lang)
|
||||
workflow = !(options[:workflow] == false)
|
||||
|
||||
Role.transaction do
|
||||
# Roles
|
||||
@@ -139,6 +140,7 @@ module Redmine
|
||||
Tracker.create!(:name => l(:default_tracker_feature), :default_status_id => new.id, :is_in_chlog => true, :is_in_roadmap => true, :position => 2)
|
||||
Tracker.create!(:name => l(:default_tracker_support), :default_status_id => new.id, :is_in_chlog => false, :is_in_roadmap => false, :position => 3)
|
||||
|
||||
if workflow
|
||||
# Workflow
|
||||
Tracker.all.each { |t|
|
||||
IssueStatus.all.each { |os|
|
||||
@@ -164,6 +166,7 @@ module Redmine
|
||||
}
|
||||
WorkflowTransition.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id)
|
||||
}
|
||||
end
|
||||
|
||||
# Enumerations
|
||||
IssuePriority.create!(:name => l(:default_priority_low), :position => 1)
|
||||
|
||||
@@ -23,21 +23,24 @@ class DefaultDataTest < ActiveSupport::TestCase
|
||||
|
||||
def test_no_data
|
||||
assert !Redmine::DefaultData::Loader::no_data?
|
||||
Role.where("builtin = 0").delete_all
|
||||
Tracker.delete_all
|
||||
IssueStatus.delete_all
|
||||
Enumeration.delete_all
|
||||
clear_data
|
||||
assert Redmine::DefaultData::Loader::no_data?
|
||||
end
|
||||
|
||||
def test_load
|
||||
clear_data
|
||||
assert Redmine::DefaultData::Loader::load('en')
|
||||
assert_not_nil DocumentCategory.first
|
||||
assert_not_nil IssuePriority.first
|
||||
assert_not_nil TimeEntryActivity.first
|
||||
assert_not_nil WorkflowTransition.first
|
||||
end
|
||||
|
||||
def test_load_for_all_language
|
||||
valid_languages.each do |lang|
|
||||
clear_data
|
||||
begin
|
||||
Role.where("builtin = 0").delete_all
|
||||
Tracker.delete_all
|
||||
IssueStatus.delete_all
|
||||
Enumeration.delete_all
|
||||
assert Redmine::DefaultData::Loader::load(lang)
|
||||
assert Redmine::DefaultData::Loader::load(lang, :workflow => false)
|
||||
assert_not_nil DocumentCategory.first
|
||||
assert_not_nil IssuePriority.first
|
||||
assert_not_nil TimeEntryActivity.first
|
||||
@@ -46,4 +49,12 @@ class DefaultDataTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def clear_data
|
||||
Role.where("builtin = 0").delete_all
|
||||
Tracker.delete_all
|
||||
IssueStatus.delete_all
|
||||
Enumeration.delete_all
|
||||
WorkflowRule.delete_all
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user