Project

General

Profile

Patch #251 » auto_end_date.diff

Elliot Winkler, 2008-02-03 11:02

View differences:

test/unit/issue_test.rb (working copy)
18 18
require File.dirname(__FILE__) + '/../test_helper'
19 19

  
20 20
class IssueTest < Test::Unit::TestCase
21
  fixtures :projects, :users, :members, :trackers, :projects_trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :time_entries
21
  fixtures :projects, :users, :members, :trackers, :projects_trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :time_entries, :versions
22 22

  
23 23
  def test_category_based_assignment
24 24
    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)
......
70 70
    # Make sure time entries were move to the target project
71 71
    assert_equal 2, issue.time_entries.first.project_id
72 72
  end
73
  
74
  def test_inherit_version_due_date_if_necessary
75
    issue = Issue.find(1)
76
    version = Version.find(1)
77
    issue.fixed_version = version
78
    issue.due_date = nil
79
    assert issue.save
80
    assert_equal issue.due_date, version.due_date
81
  end
73 82
end
app/models/issue.rb (working copy)
137 137
      }      
138 138
      @current_journal.save
139 139
    end
140
    
141
    # If the issue has a fixed version and the issue's due date is empty
142
    # then fill it in with the due date of the fixed version
143
    if (version = self.fixed_version) && self.due_date.blank?
144
      self.due_date = version.due_date
145
    end
146
    
140 147
    # Save the issue even if the journal is not saved (because empty)
141 148
    true
142 149
  end
(1-1/5)