Commit b40fb03d authored by jplang's avatar jplang

Use a single hash as argument.

git-svn-id: https://svn.redmine.org/redmine/trunk@15805 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 70e69d90
......@@ -2092,7 +2092,7 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
tracker = Tracker.find(2)
tracker.update! :default_status_id => 2
tracker.generate_transitions! 2, 1, :clear => true
tracker.generate_transitions! 2 => 1, :clear => true
post :new, :project_id => 1,
:issue => {:tracker_id => 2,
......
......@@ -243,21 +243,21 @@ module ObjectHelpers
end
module TrackerObjectHelpers
def generate_transitions!(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
if args.size == 1
args << args.first
end
if options[:clear]
def generate_transitions!(arg)
if arg.delete(:clear)
WorkflowTransition.where(:tracker_id => id).delete_all
end
args.each_cons(2) do |old_status_id, new_status_id|
WorkflowTransition.create!(
:tracker => self,
:role_id => (options[:role_id] || 1),
:old_status_id => old_status_id,
:new_status_id => new_status_id
)
role_id = arg.delete(:role_id) || 1
arg.each do |old_status_id, new_status_ids|
Array.wrap(new_status_ids).each do |new_status_id|
WorkflowTransition.create!(
:tracker => self,
:role_id => role_id,
:old_status_id => old_status_id,
:new_status_id => new_status_id
)
end
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment