]> source.dussan.org Git - redmine.git/commitdiff
add functional attachment test of mercurial export file (#11868)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 19 Sep 2012 03:02:03 +0000 (03:02 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 19 Sep 2012 03:02:03 +0000 (03:02 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10429 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/fixtures/files/hg-export.diff [new file with mode: 0644]
test/functional/attachments_controller_test.rb

diff --git a/test/fixtures/files/hg-export.diff b/test/fixtures/files/hg-export.diff
new file mode 100644 (file)
index 0000000..596617f
--- /dev/null
@@ -0,0 +1,13 @@
+# HG changeset patch
+# User test
+# Date 1348014182 -32400
+# Node ID d1c871b8ef113df7f1c56d41e6e3bfbaff976e1f
+# Parent  180b6605936cdc7909c5f08b59746ec1a7c99b3e
+modify test1.txt
+
+diff -r 180b6605936c -r d1c871b8ef11 test1.txt
+--- a/test1.txt
++++ b/test1.txt
+@@ -1,1 +1,1 @@
+-test1
++modify test1
index 11c3faa95ab0e6c716cc003516e2328d4fcee3fc..bc37c31816c2b9f6484b6150d0189f04d1d82433 100644 (file)
@@ -110,6 +110,21 @@ class AttachmentsControllerTest < ActionController::TestCase
     assert_equal "sbs", user.pref[:diff_type]
   end
 
+  def test_diff_show_filename_in_mercurial_export
+    set_tmp_attachments_directory
+    a = Attachment.new(:container => Issue.find(1),
+                       :file => uploaded_test_file("hg-export.diff", "text/plain"),
+                       :author => User.find(1))
+    assert a.save
+    assert_equal 'hg-export.diff', a.filename
+
+    get :show, :id => a.id, :type => 'inline'
+    assert_response :success
+    assert_template 'diff'
+    assert_equal 'text/html', @response.content_type
+    assert_select 'th.filename', :text => 'test1.txt'
+  end
+
   def test_show_text_file
     get :show, :id => 4
     assert_response :success