diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-24 13:01:31 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-24 13:01:31 +0000 |
commit | fae04f3ae1f66c797d6f7cd08ce4e8eba1cb3df7 (patch) | |
tree | dbe493d3ba51b4785ff2374aef6c539552b9d4e4 | |
parent | b13ef6479451ecd6ee0dff7ad02ba1496eae0f82 (diff) | |
download | redmine-fae04f3ae1f66c797d6f7cd08ce4e8eba1cb3df7.tar.gz redmine-fae04f3ae1f66c797d6f7cd08ce4e8eba1cb3df7.zip |
Merged r2246 and r2248 from trunk (#2456).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2310 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/issue.rb | 2 | ||||
-rw-r--r-- | app/views/issues/_form.rhtml | 2 | ||||
-rw-r--r-- | app/views/issues/show.rhtml | 2 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 10 | ||||
-rw-r--r-- | test/unit/issue_test.rb | 6 |
5 files changed, 14 insertions, 8 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index fcac38bde..e3a9e17ee 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -45,7 +45,7 @@ class Issue < ActiveRecord::Base acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}, :author_key => :author_id - validates_presence_of :subject, :description, :priority, :project, :tracker, :author, :status + validates_presence_of :subject, :priority, :project, :tracker, :author, :status validates_length_of :subject, :maximum => 255 validates_inclusion_of :done_ratio, :in => 0..100 validates_numericality_of :estimated_hours, :allow_nil => true diff --git a/app/views/issues/_form.rhtml b/app/views/issues/_form.rhtml index 7ae990d5f..0ca12554d 100644 --- a/app/views/issues/_form.rhtml +++ b/app/views/issues/_form.rhtml @@ -8,7 +8,7 @@ <div id="issue_descr_fields" <%= 'style="display:none"' unless @issue.new_record? || @issue.errors.any? %>> <p><%= f.text_field :subject, :size => 80, :required => true %></p> -<p><%= f.text_area :description, :required => true, +<p><%= f.text_area :description, :cols => 60, :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), :accesskey => accesskey(:edit), diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index d5babe331..28d656667 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -59,7 +59,7 @@ end %> <hr /> <div class="contextual"> -<%= link_to_remote_if_authorized l(:button_quote), { :url => {:action => 'reply', :id => @issue} }, :class => 'icon icon-comment' %> +<%= link_to_remote_if_authorized(l(:button_quote), { :url => {:action => 'reply', :id => @issue} }, :class => 'icon icon-comment') unless @issue.description.blank? %> </div> <p><strong><%=l(:field_description)%></strong></p> diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 489578a4b..d282d09e6 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -378,16 +378,16 @@ class IssuesControllerTest < Test::Unit::TestCase @request.session[:user_id] = 2 post :new, :project_id => 1, :issue => {:tracker_id => 1, - :subject => 'This is the test_new issue', - # empty description - :description => '', + # empty subject + :subject => '', + :description => 'This is a description', :priority_id => 6, :custom_field_values => {'1' => 'Oracle', '2' => 'Value for field 2'}} assert_response :success assert_template 'new' - assert_tag :input, :attributes => { :name => 'issue[subject]', - :value => 'This is the test_new issue' } + assert_tag :textarea, :attributes => { :name => 'issue[description]' }, + :content => 'This is a description' assert_tag :select, :attributes => { :name => 'issue[priority_id]' }, :child => { :tag => 'option', :attributes => { :selected => 'selected', :value => '6' }, diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 6615cac0c..ed7593a30 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -33,6 +33,12 @@ class IssueTest < Test::Unit::TestCase assert_equal 1.5, issue.estimated_hours end + def test_create_minimal + issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => Enumeration.get_values('IPRI').first, :subject => 'test_create') + assert issue.save + assert issue.description.nil? + end + def test_create_with_required_custom_field field = IssueCustomField.find_by_name('Database') field.update_attribute(:is_required, true) |