]> source.dussan.org Git - redmine.git/commitdiff
Test that forms are well-formed for issue attachment upload.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 29 Jul 2011 16:04:38 +0000 (16:04 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 29 Jul 2011 16:04:38 +0000 (16:04 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6322 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/issues_controller_test.rb

index c1bc17ffc9b7c586c2b81457803707a87ecde923..84c7e8b6cb1789cf730779ee0ead20c87f2fb2ba 100644 (file)
@@ -354,6 +354,18 @@ class IssuesControllerTest < ActionController::TestCase
     assert_no_tag :option, :attributes => {:value => '15'},
                            :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} }
   end
+  
+  def test_update_form_should_allow_attachment_upload
+    @request.session[:user_id] = 2
+    get :show, :id => 1
+    
+    assert_tag :tag => 'form',
+      :attributes => {:id => 'issue-form', :method => 'post', :enctype => 'multipart/form-data'},
+      :descendant => {
+        :tag => 'input',
+        :attributes => {:type => 'file', :name => 'attachments[1][file]'}
+      }
+  end
 
   def test_show_should_deny_anonymous_access_without_permission
     Role.anonymous.remove_permission!(:view_issues)
@@ -462,6 +474,18 @@ class IssuesControllerTest < ActionController::TestCase
     assert_no_tag :option, :attributes => {:value => '15'},
                            :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} }
   end
+  
+  def test_get_new_form_should_allow_attachment_upload
+    @request.session[:user_id] = 2
+    get :new, :project_id => 1, :tracker_id => 1
+    
+    assert_tag :tag => 'form',
+      :attributes => {:id => 'issue-form', :method => 'post', :enctype => 'multipart/form-data'},
+      :descendant => {
+        :tag => 'input',
+        :attributes => {:type => 'file', :name => 'attachments[1][file]'}
+      }
+  end
 
   def test_get_new_without_tracker_id
     @request.session[:user_id] = 2