summaryrefslogtreecommitdiffstats
path: root/test/object_helpers.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-22 12:47:50 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-22 12:47:50 +0000
commitccf37f59a93c324f065d3fccad0339980bdff8bf (patch)
tree14b4632a27a6b4c84be7b1673fceea6440162838 /test/object_helpers.rb
parent0fad78f53f54bb8133c55a603c4175887b38866e (diff)
downloadredmine-ccf37f59a93c324f065d3fccad0339980bdff8bf.tar.gz
redmine-ccf37f59a93c324f065d3fccad0339980bdff8bf.zip
Methods moved.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9473 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/object_helpers.rb')
-rw-r--r--test/object_helpers.rb36
1 files changed, 18 insertions, 18 deletions
diff --git a/test/object_helpers.rb b/test/object_helpers.rb
index 7be05606f..6db4336cf 100644
--- a/test/object_helpers.rb
+++ b/test/object_helpers.rb
@@ -1,9 +1,4 @@
module ObjectHelpers
- def User.add_to_project(user, project, roles)
- roles = [roles] unless roles.is_a?(Array)
- Member.create!(:principal => user, :project => project, :roles => roles)
- end
-
def User.generate!(attributes={})
@generated_user_login ||= 'user0'
@generated_user_login.succ!
@@ -17,6 +12,11 @@ module ObjectHelpers
user
end
+ def User.add_to_project(user, project, roles)
+ roles = [roles] unless roles.is_a?(Array)
+ Member.create!(:principal => user, :project => project, :roles => roles)
+ end
+
def Group.generate!(attributes={})
@generated_group_name ||= 'Group 0'
@generated_group_name.succ!
@@ -67,6 +67,19 @@ module ObjectHelpers
issue
end
+ # Generate an issue for a project, using its trackers
+ def Issue.generate_for_project!(project, attributes={})
+ issue = Issue.new(attributes) do |issue|
+ issue.project = project
+ issue.tracker = project.trackers.first unless project.trackers.empty?
+ issue.subject = 'Generated' if issue.subject.blank?
+ issue.author ||= User.find(2)
+ yield issue if block_given?
+ end
+ issue.save!
+ issue
+ end
+
def Version.generate!(attributes={})
@generated_version_name ||= 'Version 0'
@generated_version_name.succ!
@@ -86,17 +99,4 @@ module ObjectHelpers
source.save!
source
end
-
- # Generate an issue for a project, using it's trackers
- def Issue.generate_for_project!(project, attributes={})
- issue = Issue.new(attributes) do |issue|
- issue.project = project
- issue.tracker = project.trackers.first unless project.trackers.empty?
- issue.subject = 'Generated' if issue.subject.blank?
- issue.author ||= User.find(2)
- yield issue if block_given?
- end
- issue.save!
- issue
- end
end