Patch #251 » auto_end_date.diff
| test/unit/issue_test.rb (working copy) | ||
|---|---|---|
|
require File.dirname(__FILE__) + '/../test_helper'
|
||
|
class IssueTest < Test::Unit::TestCase
|
||
|
fixtures :projects, :users, :members, :trackers, :projects_trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :time_entries
|
||
|
fixtures :projects, :users, :members, :trackers, :projects_trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :time_entries, :versions
|
||
|
def test_category_based_assignment
|
||
|
issue = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => Enumeration.get_values('IPRI').first, :subject => 'Assignment test', :description => 'Assignment test', :category_id => 1)
|
||
| ... | ... | |
|
# Make sure time entries were move to the target project
|
||
|
assert_equal 2, issue.time_entries.first.project_id
|
||
|
end
|
||
|
|
||
|
def test_inherit_version_due_date_if_necessary
|
||
|
issue = Issue.find(1)
|
||
|
version = Version.find(1)
|
||
|
issue.fixed_version = version
|
||
|
issue.due_date = nil
|
||
|
assert issue.save
|
||
|
assert_equal issue.due_date, version.due_date
|
||
|
end
|
||
|
end
|
||
| app/models/issue.rb (working copy) | ||
|---|---|---|
|
}
|
||
|
@current_journal.save
|
||
|
end
|
||
|
|
||
|
# If the issue has a fixed version and the issue's due date is empty
|
||
|
# then fill it in with the due date of the fixed version
|
||
|
if (version = self.fixed_version) && self.due_date.blank?
|
||
|
self.due_date = version.due_date
|
||
|
end
|
||
|
|
||
|
# Save the issue even if the journal is not saved (because empty)
|
||
|
true
|
||
|
end
|
||