summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-09-01 17:39:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-09-01 17:39:02 +0000
commitddc575564744cbc65600a0aaf92f55ec65570e83 (patch)
treeb8e5a37f3e7b7b26746ed4c6d2195ed2b0aed748 /test
parent30ff76db0fc60dd1dcde7949501e1552f67df5b6 (diff)
downloadredmine-ddc575564744cbc65600a0aaf92f55ec65570e83.tar.gz
redmine-ddc575564744cbc65600a0aaf92f55ec65570e83.zip
Use a single hash as argument.
git-svn-id: http://svn.redmine.org/redmine/trunk@15805 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb2
-rw-r--r--test/object_helpers.rb26
2 files changed, 14 insertions, 14 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 45605bd9e..61c03af60 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -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,
diff --git a/test/object_helpers.rb b/test/object_helpers.rb
index 46673638a..3928dd5cc 100644
--- a/test/object_helpers.rb
+++ b/test/object_helpers.rb
@@ -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