diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-12 08:39:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-10-12 08:39:22 +0000 |
commit | 8bde60dc56e47316aa6dbd22ab75a305c1dfc9ae (patch) | |
tree | 791c24302d556496f3f80be5a4ee910ffadbd2bf /test/object_helpers.rb | |
parent | d8f039f48920887a50d1c555109dded05393b107 (diff) | |
download | redmine-8bde60dc56e47316aa6dbd22ab75a305c1dfc9ae.tar.gz redmine-8bde60dc56e47316aa6dbd22ab75a305c1dfc9ae.zip |
Remove Issue.generate_for_project! test helper and use Issue.generate! instead.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10611 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/object_helpers.rb')
-rw-r--r-- | test/object_helpers.rb | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/test/object_helpers.rb b/test/object_helpers.rb index e0ed4ee98..2c224bcfc 100644 --- a/test/object_helpers.rb +++ b/test/object_helpers.rb @@ -61,6 +61,8 @@ module ObjectHelpers def Issue.generate!(attributes={}) issue = Issue.new(attributes) + issue.project ||= Project.find(1) + issue.tracker ||= issue.project.trackers.first issue.subject = 'Generated' if issue.subject.blank? issue.author ||= User.find(2) yield issue if block_given? @@ -68,25 +70,12 @@ 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 - # Generates an issue with some children and a grandchild def Issue.generate_with_descendants!(project, attributes={}) - issue = Issue.generate_for_project!(project, attributes) - child = Issue.generate_for_project!(project, :subject => 'Child1', :parent_issue_id => issue.id) - Issue.generate_for_project!(project, :subject => 'Child2', :parent_issue_id => issue.id) - Issue.generate_for_project!(project, :subject => 'Child11', :parent_issue_id => child.id) + issue = Issue.generate!(attributes.merge(:project => project)) + child = Issue.generate!(:project => project, :subject => 'Child1', :parent_issue_id => issue.id) + Issue.generate!(:project => project, :subject => 'Child2', :parent_issue_id => issue.id) + Issue.generate!(:project => project, :subject => 'Child11', :parent_issue_id => child.id) issue.reload end |