|
@@
-657,7
+657,7
class IssuesControllerTest < ActionController::TestCase
|
|
657
|
assert_select_rjs :show, "update"
|
|
657
|
assert_select_rjs :show, "update"
|
|
658
|
end
|
|
658
|
end
|
|
659
|
|
|
659
|
|
|
660
|
def test_post_edit_without_custom_fields_param
|
|
660
|
def test_put_update_without_custom_fields_param
|
|
661
|
@request.session[:user_id] = 2
|
|
661
|
@request.session[:user_id] = 2
|
|
662
|
ActionMailer::Base.deliveries.clear
|
|
662
|
ActionMailer::Base.deliveries.clear
|
|
663
|
|
|
663
|
|
|
@@
-668,7
+668,7
class IssuesControllerTest < ActionController::TestCase
|
|
668
|
|
|
668
|
|
|
669
|
assert_difference('Journal.count') do
|
|
669
|
assert_difference('Journal.count') do
|
|
670
|
assert_difference('JournalDetail.count', 2) do
|
|
670
|
assert_difference('JournalDetail.count', 2) do
|
|
671
|
post :edit, :id => 1, :issue => {:subject => new_subject,
|
|
671
|
put :update, :id => 1, :issue => {:subject => new_subject,
|
|
672
|
:priority_id => '6',
|
|
672
|
:priority_id => '6',
|
|
673
|
:category_id => '1' # no change
|
|
673
|
:category_id => '1' # no change
|
|
674
|
}
|
|
674
|
}
|
|
@@
-686,14
+686,14
class IssuesControllerTest < ActionController::TestCase
|
|
686
|
assert mail.body.include?("Subject changed from #{old_subject} to #{new_subject}")
|
|
686
|
assert mail.body.include?("Subject changed from #{old_subject} to #{new_subject}")
|
|
687
|
end
|
|
687
|
end
|
|
688
|
|
|
688
|
|
|
689
|
def test_post_edit_with_custom_field_change
|
|
689
|
def test_put_update_with_custom_field_change
|
|
690
|
@request.session[:user_id] = 2
|
|
690
|
@request.session[:user_id] = 2
|
|
691
|
issue = Issue.find(1)
|
|
691
|
issue = Issue.find(1)
|
|
692
|
assert_equal '125', issue.custom_value_for(2).value
|
|
692
|
assert_equal '125', issue.custom_value_for(2).value
|
|
693
|
|
|
693
|
|
|
694
|
assert_difference('Journal.count') do
|
|
694
|
assert_difference('Journal.count') do
|
|
695
|
assert_difference('JournalDetail.count', 3) do
|
|
695
|
assert_difference('JournalDetail.count', 3) do
|
|
696
|
post :edit, :id => 1, :issue => {:subject => 'Custom field change',
|
|
696
|
put :update, :id => 1, :issue => {:subject => 'Custom field change',
|
|
697
|
:priority_id => '6',
|
|
697
|
:priority_id => '6',
|
|
698
|
:category_id => '1', # no change
|
|
698
|
:category_id => '1', # no change
|
|
699
|
:custom_field_values => { '2' => 'New custom value' }
|
|
699
|
:custom_field_values => { '2' => 'New custom value' }
|
|
@@
-709,12
+709,12
class IssuesControllerTest < ActionController::TestCase
|
|
709
|
assert mail.body.include?("Searchable field changed from 125 to New custom value")
|
|
709
|
assert mail.body.include?("Searchable field changed from 125 to New custom value")
|
|
710
|
end
|
|
710
|
end
|
|
711
|
|
|
711
|
|
|
712
|
def test_post_edit_with_status_and_assignee_change
|
|
712
|
def test_put_update_with_status_and_assignee_change
|
|
713
|
issue = Issue.find(1)
|
|
713
|
issue = Issue.find(1)
|
|
714
|
assert_equal 1, issue.status_id
|
|
714
|
assert_equal 1, issue.status_id
|
|
715
|
@request.session[:user_id] = 2
|
|
715
|
@request.session[:user_id] = 2
|
|
716
|
assert_difference('TimeEntry.count', 0) do
|
|
716
|
assert_difference('TimeEntry.count', 0) do
|
|
717
|
post :edit,
|
|
717
|
put :update,
|
|
718
|
:id => 1,
|
|
718
|
:id => 1,
|
|
719
|
:issue => { :status_id => 2, :assigned_to_id => 3 },
|
|
719
|
:issue => { :status_id => 2, :assigned_to_id => 3 },
|
|
720
|
:notes => 'Assigned to dlopper',
|
|
720
|
:notes => 'Assigned to dlopper',
|
|
@@
-733,10
+733,10
class IssuesControllerTest < ActionController::TestCase
|
|
733
|
assert mail.subject.include?("(#{ IssueStatus.find(2).name })")
|
|
733
|
assert mail.subject.include?("(#{ IssueStatus.find(2).name })")
|
|
734
|
end
|
|
734
|
end
|
|
735
|
|
|
735
|
|
|
736
|
def test_post_edit_with_note_only
|
|
736
|
def test_put_update_with_note_only
|
|
737
|
notes = 'Note added by IssuesControllerTest#test_update_with_note_only'
|
|
737
|
notes = 'Note added by IssuesControllerTest#test_update_with_note_only'
|
|
738
|
# anonymous user
|
|
738
|
# anonymous user
|
|
739
|
post :edit,
|
|
739
|
put :update,
|
|
740
|
:id => 1,
|
|
740
|
:id => 1,
|
|
741
|
:notes => notes
|
|
741
|
:notes => notes
|
|
742
|
assert_redirected_to :action => 'show', :id => '1'
|
|
742
|
assert_redirected_to :action => 'show', :id => '1'
|
|
@@
-749,11
+749,11
class IssuesControllerTest < ActionController::TestCase
|
|
749
|
assert mail.body.include?(notes)
|
|
749
|
assert mail.body.include?(notes)
|
|
750
|
end
|
|
750
|
end
|
|
751
|
|
|
751
|
|
|
752
|
def test_post_edit_with_note_and_spent_time
|
|
752
|
def test_put_update_with_note_and_spent_time
|
|
753
|
@request.session[:user_id] = 2
|
|
753
|
@request.session[:user_id] = 2
|
|
754
|
spent_hours_before = Issue.find(1).spent_hours
|
|
754
|
spent_hours_before = Issue.find(1).spent_hours
|
|
755
|
assert_difference('TimeEntry.count') do
|
|
755
|
assert_difference('TimeEntry.count') do
|
|
756
|
post :edit,
|
|
756
|
put :update,
|
|
757
|
:id => 1,
|
|
757
|
:id => 1,
|
|
758
|
:notes => '2.5 hours added',
|
|
758
|
:notes => '2.5 hours added',
|
|
759
|
:time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first }
|
|
759
|
:time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first }
|
|
@@
-772,7
+772,7
class IssuesControllerTest < ActionController::TestCase
|
|
772
|
assert_equal spent_hours_before + 2.5, issue.spent_hours
|
|
772
|
assert_equal spent_hours_before + 2.5, issue.spent_hours
|
|
773
|
end
|
|
773
|
end
|
|
774
|
|
|
774
|
|
|
775
|
def test_post_edit_with_attachment_only
|
|
775
|
def test_put_update_with_attachment_only
|
|
776
|
set_tmp_attachments_directory
|
|
776
|
set_tmp_attachments_directory
|
|
777
|
|
|
777
|
|
|
778
|
# Delete all fixtured journals, a race condition can occur causing the wrong
|
|
778
|
# Delete all fixtured journals, a race condition can occur causing the wrong
|
|
@@
-780,7
+780,7
class IssuesControllerTest < ActionController::TestCase
|
|
780
|
Journal.delete_all
|
|
780
|
Journal.delete_all
|
|
781
|
|
|
781
|
|
|
782
|
# anonymous user
|
|
782
|
# anonymous user
|
|
783
|
post :edit,
|
|
783
|
put :update,
|
|
784
|
:id => 1,
|
|
784
|
:id => 1,
|
|
785
|
:notes => '',
|
|
785
|
:notes => '',
|
|
786
|
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
|
|
786
|
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
|
|
@@
-795,12
+795,12
class IssuesControllerTest < ActionController::TestCase
|
|
795
|
assert mail.body.include?('testfile.txt')
|
|
795
|
assert mail.body.include?('testfile.txt')
|
|
796
|
end
|
|
796
|
end
|
|
797
|
|
|
797
|
|
|
798
|
def test_post_edit_with_no_change
|
|
798
|
def test_put_update_with_no_change
|
|
799
|
issue = Issue.find(1)
|
|
799
|
issue = Issue.find(1)
|
|
800
|
issue.journals.clear
|
|
800
|
issue.journals.clear
|
|
801
|
ActionMailer::Base.deliveries.clear
|
|
801
|
ActionMailer::Base.deliveries.clear
|
|
802
|
|
|
802
|
|
|
803
|
post :edit,
|
|
803
|
put :update,
|
|
804
|
:id => 1,
|
|
804
|
:id => 1,
|
|
805
|
:notes => ''
|
|
805
|
:notes => ''
|
|
806
|
assert_redirected_to :action => 'show', :id => '1'
|
|
806
|
assert_redirected_to :action => 'show', :id => '1'
|
|
@@
-811,26
+811,26
class IssuesControllerTest < ActionController::TestCase
|
|
811
|
assert ActionMailer::Base.deliveries.empty?
|
|
811
|
assert ActionMailer::Base.deliveries.empty?
|
|
812
|
end
|
|
812
|
end
|
|
813
|
|
|
813
|
|
|
814
|
def test_post_edit_should_send_a_notification
|
|
814
|
def test_put_update_should_send_a_notification
|
|
815
|
@request.session[:user_id] = 2
|
|
815
|
@request.session[:user_id] = 2
|
|
816
|
ActionMailer::Base.deliveries.clear
|
|
816
|
ActionMailer::Base.deliveries.clear
|
|
817
|
issue = Issue.find(1)
|
|
817
|
issue = Issue.find(1)
|
|
818
|
old_subject = issue.subject
|
|
818
|
old_subject = issue.subject
|
|
819
|
new_subject = 'Subject modified by IssuesControllerTest#test_post_edit'
|
|
819
|
new_subject = 'Subject modified by IssuesControllerTest#test_post_edit'
|
|
820
|
|
|
820
|
|
|
821
|
post :edit, :id => 1, :issue => {:subject => new_subject,
|
|
821
|
put :update, :id => 1, :issue => {:subject => new_subject,
|
|
822
|
:priority_id => '6',
|
|
822
|
:priority_id => '6',
|
|
823
|
:category_id => '1' # no change
|
|
823
|
:category_id => '1' # no change
|
|
824
|
}
|
|
824
|
}
|
|
825
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
|
825
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
|
826
|
end
|
|
826
|
end
|
|
827
|
|
|
827
|
|
|
828
|
def test_post_edit_with_invalid_spent_time
|
|
828
|
def test_put_update_with_invalid_spent_time
|
|
829
|
@request.session[:user_id] = 2
|
|
829
|
@request.session[:user_id] = 2
|
|
830
|
notes = 'Note added by IssuesControllerTest#test_post_edit_with_invalid_spent_time'
|
|
830
|
notes = 'Note added by IssuesControllerTest#test_post_edit_with_invalid_spent_time'
|
|
831
|
|
|
831
|
|
|
832
|
assert_no_difference('Journal.count') do
|
|
832
|
assert_no_difference('Journal.count') do
|
|
833
|
post :edit,
|
|
833
|
put :update,
|
|
834
|
:id => 1,
|
|
834
|
:id => 1,
|
|
835
|
:notes => notes,
|
|
835
|
:notes => notes,
|
|
836
|
:time_entry => {"comments"=>"", "activity_id"=>"", "hours"=>"2z"}
|
|
836
|
:time_entry => {"comments"=>"", "activity_id"=>"", "hours"=>"2z"}
|
|
@@
-843,11
+843,11
class IssuesControllerTest < ActionController::TestCase
|
|
843
|
assert_tag :input, :attributes => { :name => 'time_entry[hours]', :value => "2z" }
|
|
843
|
assert_tag :input, :attributes => { :name => 'time_entry[hours]', :value => "2z" }
|
|
844
|
end
|
|
844
|
end
|
|
845
|
|
|
845
|
|
|
846
|
def test_post_edit_should_allow_fixed_version_to_be_set_to_a_subproject
|
|
846
|
def test_put_update_should_allow_fixed_version_to_be_set_to_a_subproject
|
|
847
|
issue = Issue.find(2)
|
|
847
|
issue = Issue.find(2)
|
|
848
|
@request.session[:user_id] = 2
|
|
848
|
@request.session[:user_id] = 2
|
|
849
|
|
|
849
|
|
|
850
|
post :edit,
|
|
850
|
put :update,
|
|
851
|
:id => issue.id,
|
|
851
|
:id => issue.id,
|
|
852
|
:issue => {
|
|
852
|
:issue => {
|
|
853
|
:fixed_version_id => 4
|
|
853
|
:fixed_version_id => 4
|
|
@@
-859,11
+859,11
class IssuesControllerTest < ActionController::TestCase
|
|
859
|
assert_not_equal issue.project_id, issue.fixed_version.project_id
|
|
859
|
assert_not_equal issue.project_id, issue.fixed_version.project_id
|
|
860
|
end
|
|
860
|
end
|
|
861
|
|
|
861
|
|
|
862
|
def test_post_edit_should_redirect_back_using_the_back_url_parameter
|
|
862
|
def test_put_update_should_redirect_back_using_the_back_url_parameter
|
|
863
|
issue = Issue.find(2)
|
|
863
|
issue = Issue.find(2)
|
|
864
|
@request.session[:user_id] = 2
|
|
864
|
@request.session[:user_id] = 2
|
|
865
|
|
|
865
|
|
|
866
|
post :edit,
|
|
866
|
put :update,
|
|
867
|
:id => issue.id,
|
|
867
|
:id => issue.id,
|
|
868
|
:issue => {
|
|
868
|
:issue => {
|
|
869
|
:fixed_version_id => 4
|
|
869
|
:fixed_version_id => 4
|
|
@@
-874,11
+874,11
class IssuesControllerTest < ActionController::TestCase
|
|
874
|
assert_redirected_to '/issues'
|
|
874
|
assert_redirected_to '/issues'
|
|
875
|
end
|
|
875
|
end
|
|
876
|
|
|
876
|
|
|
877
|
def test_post_edit_should_not_redirect_back_using_the_back_url_parameter_off_the_host
|
|
877
|
def test_put_update_should_not_redirect_back_using_the_back_url_parameter_off_the_host
|
|
878
|
issue = Issue.find(2)
|
|
878
|
issue = Issue.find(2)
|
|
879
|
@request.session[:user_id] = 2
|
|
879
|
@request.session[:user_id] = 2
|
|
880
|
|
|
880
|
|
|
881
|
post :edit,
|
|
881
|
put :update,
|
|
882
|
:id => issue.id,
|
|
882
|
:id => issue.id,
|
|
883
|
:issue => {
|
|
883
|
:issue => {
|
|
884
|
:fixed_version_id => 4
|
|
884
|
:fixed_version_id => 4
|