]> source.dussan.org Git - redmine.git/commitdiff
Adds a system test for creating an issue with attachment.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Jul 2017 08:19:25 +0000 (08:19 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Jul 2017 08:19:25 +0000 (08:19 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16907 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/system/issues_test.rb

index c174ff7a31e594faeaae0f426cb66d1943299bcb..67d33949047a71d1017c7a94a71a355aeb9b59f4 100644 (file)
@@ -134,6 +134,23 @@ class IssuesTest < ApplicationSystemTestCase
     assert_equal ['Dave Lopper', 'Some Watcher'], issue.watcher_users.map(&:name).sort
   end
 
+  def test_create_issue_with_attachment
+    set_tmp_attachments_directory
+    log_user('jsmith', 'jsmith')
+
+    issue = new_record(Issue) do
+      visit '/projects/ecookbook/issues/new'
+      fill_in 'Subject', :with => 'Issue with attachment'
+      attach_file 'attachments[dummy][file]', Rails.root.join('test/fixtures/files/testfile.txt')
+      fill_in 'attachments[1][description]', :with => 'Some description'
+      click_on 'Create'
+    end
+    assert_equal 1, issue.attachments.count
+    assert_equal 'Some description', issue.attachments.first.description
+  ensure
+    set_fixtures_attachments_directory
+  end
+
   def test_preview_issue_description
     log_user('jsmith', 'jsmith')
     visit '/projects/ecookbook/issues/new'