@@ -45,7 +45,7 class Issue < ActiveRecord::Base | |||||
45 | acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}, |
|
45 | acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}, | |
46 | :author_key => :author_id |
|
46 | :author_key => :author_id | |
47 |
|
47 | |||
48 |
validates_presence_of :subject |
|
48 | validates_presence_of :subject, :priority, :project, :tracker, :author, :status | |
49 | validates_length_of :subject, :maximum => 255 |
|
49 | validates_length_of :subject, :maximum => 255 | |
50 | validates_inclusion_of :done_ratio, :in => 0..100 |
|
50 | validates_inclusion_of :done_ratio, :in => 0..100 | |
51 | validates_numericality_of :estimated_hours, :allow_nil => true |
|
51 | validates_numericality_of :estimated_hours, :allow_nil => true |
@@ -8,7 +8,7 | |||||
8 |
|
8 | |||
9 | <div id="issue_descr_fields" <%= 'style="display:none"' unless @issue.new_record? || @issue.errors.any? %>> |
|
9 | <div id="issue_descr_fields" <%= 'style="display:none"' unless @issue.new_record? || @issue.errors.any? %>> | |
10 | <p><%= f.text_field :subject, :size => 80, :required => true %></p> |
|
10 | <p><%= f.text_field :subject, :size => 80, :required => true %></p> | |
11 |
<p><%= f.text_area :description, |
|
11 | <p><%= f.text_area :description, | |
12 | :cols => 60, |
|
12 | :cols => 60, | |
13 | :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), |
|
13 | :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), | |
14 | :accesskey => accesskey(:edit), |
|
14 | :accesskey => accesskey(:edit), |
@@ -59,7 +59,7 end %> | |||||
59 | <hr /> |
|
59 | <hr /> | |
60 |
|
60 | |||
61 | <div class="contextual"> |
|
61 | <div class="contextual"> | |
62 |
<%= link_to_remote_if_authorized |
|
62 | <%= link_to_remote_if_authorized(l(:button_quote), { :url => {:action => 'reply', :id => @issue} }, :class => 'icon icon-comment') unless @issue.description.blank? %> | |
63 | </div> |
|
63 | </div> | |
64 |
|
64 | |||
65 | <p><strong><%=l(:field_description)%></strong></p> |
|
65 | <p><strong><%=l(:field_description)%></strong></p> |
@@ -378,16 +378,16 class IssuesControllerTest < Test::Unit::TestCase | |||||
378 | @request.session[:user_id] = 2 |
|
378 | @request.session[:user_id] = 2 | |
379 | post :new, :project_id => 1, |
|
379 | post :new, :project_id => 1, | |
380 | :issue => {:tracker_id => 1, |
|
380 | :issue => {:tracker_id => 1, | |
381 |
|
|
381 | # empty subject | |
382 |
|
|
382 | :subject => '', | |
383 | :description => '', |
|
383 | :description => 'This is a description', | |
384 | :priority_id => 6, |
|
384 | :priority_id => 6, | |
385 | :custom_field_values => {'1' => 'Oracle', '2' => 'Value for field 2'}} |
|
385 | :custom_field_values => {'1' => 'Oracle', '2' => 'Value for field 2'}} | |
386 | assert_response :success |
|
386 | assert_response :success | |
387 | assert_template 'new' |
|
387 | assert_template 'new' | |
388 |
|
388 | |||
389 |
assert_tag : |
|
389 | assert_tag :textarea, :attributes => { :name => 'issue[description]' }, | |
390 |
|
|
390 | :content => 'This is a description' | |
391 | assert_tag :select, :attributes => { :name => 'issue[priority_id]' }, |
|
391 | assert_tag :select, :attributes => { :name => 'issue[priority_id]' }, | |
392 | :child => { :tag => 'option', :attributes => { :selected => 'selected', |
|
392 | :child => { :tag => 'option', :attributes => { :selected => 'selected', | |
393 | :value => '6' }, |
|
393 | :value => '6' }, |
@@ -33,6 +33,12 class IssueTest < Test::Unit::TestCase | |||||
33 | assert_equal 1.5, issue.estimated_hours |
|
33 | assert_equal 1.5, issue.estimated_hours | |
34 | end |
|
34 | end | |
35 |
|
35 | |||
|
36 | def test_create_minimal | |||
|
37 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => Enumeration.get_values('IPRI').first, :subject => 'test_create') | |||
|
38 | assert issue.save | |||
|
39 | assert issue.description.nil? | |||
|
40 | end | |||
|
41 | ||||
36 | def test_create_with_required_custom_field |
|
42 | def test_create_with_required_custom_field | |
37 | field = IssueCustomField.find_by_name('Database') |
|
43 | field = IssueCustomField.find_by_name('Database') | |
38 | field.update_attribute(:is_required, true) |
|
44 | field.update_attribute(:is_required, true) |
General Comments 0
You need to be logged in to leave comments.
Login now