summaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-10-20 00:36:51 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-10-20 00:36:51 +0000
commit6456f7c4a4816b2db4da5a5f7e358517a66fe963 (patch)
tree4489768a6b14bbc903622458d94642a59af2b202 /test/test_helper.rb
parent61c09b64426981a6da16e5fcd42ab4b796a46f05 (diff)
downloadredmine-6456f7c4a4816b2db4da5a5f7e358517a66fe963.tar.gz
redmine-6456f7c4a4816b2db4da5a5f7e358517a66fe963.zip
Updated some object_daddy exemplars for the Models.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2937 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 37f8bfd00..3a3b12424 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -34,6 +34,24 @@ def User.generate_with_protected!(attributes={})
user
end
+# Generate the default Query
+def Query.generate_default!(attributes={})
+ query = Query.spawn(attributes)
+ query.name ||= '_'
+ query.save!
+ query
+end
+
+# Generate an issue for a project, using it's trackers
+def Issue.generate_for_project!(project, attributes={})
+ issue = Issue.spawn(attributes) do |issue|
+ issue.project = project
+ end
+ issue.tracker = project.trackers.first unless project.trackers.empty?
+ issue.save!
+ issue
+end
+
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the