allow_empty_descriptions-1014.diff

Eric Davis, 2008-05-07 02:26

Download (2.17 KB)

View differences:

app/models/issue.rb
40 40
  acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id}: #{o.subject}"},
41 41
                :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}}                
42 42
  
43
  validates_presence_of :subject, :description, :priority, :project, :tracker, :author, :status
43
  validates_presence_of :subject, :priority, :project, :tracker, :author, :status
44 44
  validates_length_of :subject, :maximum => 255
45 45
  validates_inclusion_of :done_ratio, :in => 0..100
46 46
  validates_numericality_of :estimated_hours, :allow_nil => true
app/views/issues/_form.rhtml
9 9

  
10 10
<div id="issue_descr_fields" <%= 'style="display:none"' unless @issue.new_record? || @issue.errors.any? %>>
11 11
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
12
<p><%= f.text_area :description, :required => true,
12
<p><%= f.text_area :description,
13 13
                   :cols => 60,
14 14
                   :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
15 15
                   :accesskey => accesskey(:edit),
test/unit/issue_test.rb
26 26
    issue.reload
27 27
    assert_equal 1.5, issue.estimated_hours
28 28
  end
29

  
30
  def test_create_with_empty_description
31
    issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => Enumeration.get_values('IPRI').first, :subject => 'test_create', :estimated_hours => '1:30')
32
    assert issue.save
33
  end
29 34
  
30 35
  def test_category_based_assignment
31 36
    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)