@@ -536,7 +536,7 class Issue < ActiveRecord::Base | |||
|
536 | 536 | # Returns false if save fails |
|
537 | 537 | def save_issue_with_child_records(params, existing_time_entry=nil) |
|
538 | 538 | Issue.transaction do |
|
539 | if params[:time_entry] && params[:time_entry][:hours].present? && User.current.allowed_to?(:log_time, project) | |
|
539 | if params[:time_entry] && (params[:time_entry][:hours].present? || params[:time_entry][:comments].present?) && User.current.allowed_to?(:log_time, project) | |
|
540 | 540 | @time_entry = existing_time_entry || TimeEntry.new |
|
541 | 541 | @time_entry.project = project |
|
542 | 542 | @time_entry.issue = self |
@@ -1002,7 +1002,7 class IssuesControllerTest < ActionController::TestCase | |||
|
1002 | 1002 | assert_equal 1, ActionMailer::Base.deliveries.size |
|
1003 | 1003 | end |
|
1004 | 1004 | |
|
1005 | def test_put_update_with_invalid_spent_time | |
|
1005 | def test_put_update_with_invalid_spent_time_hours_only | |
|
1006 | 1006 | @request.session[:user_id] = 2 |
|
1007 | 1007 | notes = 'Note added by IssuesControllerTest#test_post_edit_with_invalid_spent_time' |
|
1008 | 1008 | |
@@ -1015,11 +1015,30 class IssuesControllerTest < ActionController::TestCase | |||
|
1015 | 1015 | assert_response :success |
|
1016 | 1016 | assert_template 'edit' |
|
1017 | 1017 | |
|
1018 | assert_tag :textarea, :attributes => { :name => 'notes' }, | |
|
1019 | :content => notes | |
|
1018 | assert_error_tag :descendant => {:content => /Activity can't be blank/} | |
|
1019 | assert_tag :textarea, :attributes => { :name => 'notes' }, :content => notes | |
|
1020 | 1020 | assert_tag :input, :attributes => { :name => 'time_entry[hours]', :value => "2z" } |
|
1021 | 1021 | end |
|
1022 | 1022 | |
|
1023 | def test_put_update_with_invalid_spent_time_comments_only | |
|
1024 | @request.session[:user_id] = 2 | |
|
1025 | notes = 'Note added by IssuesControllerTest#test_post_edit_with_invalid_spent_time' | |
|
1026 | ||
|
1027 | assert_no_difference('Journal.count') do | |
|
1028 | put :update, | |
|
1029 | :id => 1, | |
|
1030 | :notes => notes, | |
|
1031 | :time_entry => {"comments"=>"this is my comment", "activity_id"=>"", "hours"=>""} | |
|
1032 | end | |
|
1033 | assert_response :success | |
|
1034 | assert_template 'edit' | |
|
1035 | ||
|
1036 | assert_error_tag :descendant => {:content => /Activity can't be blank/} | |
|
1037 | assert_error_tag :descendant => {:content => /Hours can't be blank/} | |
|
1038 | assert_tag :textarea, :attributes => { :name => 'notes' }, :content => notes | |
|
1039 | assert_tag :input, :attributes => { :name => 'time_entry[comments]', :value => "this is my comment" } | |
|
1040 | end | |
|
1041 | ||
|
1023 | 1042 | def test_put_update_should_allow_fixed_version_to_be_set_to_a_subproject |
|
1024 | 1043 | issue = Issue.find(2) |
|
1025 | 1044 | @request.session[:user_id] = 2 |
General Comments 0
You need to be logged in to leave comments.
Login now