mirror of
https://github.com/meineerde/redmine.git
synced 2025-10-17 17:01:01 +00:00
Use a single hash as argument.
git-svn-id: http://svn.redmine.org/redmine/trunk@15805 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
30ff76db0f
commit
ddc5755647
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user