summaryrefslogtreecommitdiffstats
path: root/test/functional/issues_controller_transaction_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-16 21:00:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-16 21:00:11 +0000
commitd4e6355eb3f220787e9374eeef6fb496f213f0d1 (patch)
tree1fe20acbf595c1df2407cc563ed37acf74292c10 /test/functional/issues_controller_transaction_test.rb
parenta8f98bb74903954f28c4299f4ea7a7279d9028dd (diff)
downloadredmine-d4e6355eb3f220787e9374eeef6fb496f213f0d1.tar.gz
redmine-d4e6355eb3f220787e9374eeef6fb496f213f0d1.zip
Better handling of attachments when issue validation fails (#10253).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8891 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/issues_controller_transaction_test.rb')
-rw-r--r--test/functional/issues_controller_transaction_test.rb35
1 files changed, 30 insertions, 5 deletions
diff --git a/test/functional/issues_controller_transaction_test.rb b/test/functional/issues_controller_transaction_test.rb
index 75c0b6a83..58af193ac 100644
--- a/test/functional/issues_controller_transaction_test.rb
+++ b/test/functional/issues_controller_transaction_test.rb
@@ -58,7 +58,33 @@ class IssuesControllerTransactionTest < ActionController::TestCase
assert_no_difference 'Journal.count' do
assert_no_difference 'TimeEntry.count' do
- assert_no_difference 'Attachment.count' do
+ put :update,
+ :id => issue.id,
+ :issue => {
+ :fixed_version_id => 4,
+ :lock_version => (issue.lock_version - 1)
+ },
+ :notes => 'My notes',
+ :time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
+ end
+ end
+
+ assert_response :success
+ assert_template 'edit'
+ assert_tag 'div', :attributes => {:class => 'conflict'}
+ assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'overwrite'}
+ assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'add_notes'}
+ assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'cancel'}
+ end
+
+ def test_update_stale_issue_should_save_attachments
+ set_tmp_attachments_directory
+ issue = Issue.find(2)
+ @request.session[:user_id] = 2
+
+ assert_no_difference 'Journal.count' do
+ assert_no_difference 'TimeEntry.count' do
+ assert_difference 'Attachment.count' do
put :update,
:id => issue.id,
:issue => {
@@ -74,10 +100,9 @@ class IssuesControllerTransactionTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
- assert_tag 'div', :attributes => {:class => 'conflict'}
- assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'overwrite'}
- assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'add_notes'}
- assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'cancel'}
+ attachment = Attachment.first(:order => 'id DESC')
+ assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token}
+ assert_tag 'span', :content => /testfile.txt/
end
def test_update_stale_issue_without_notes_should_not_show_add_notes_option